Skip to content

Commit 6761fca

Browse files
Merge remote-tracking branch 'origin/release-6.7.8' into release-7.1.1
Clean merge
2 parents 9049465 + 99671c9 commit 6761fca

2 files changed

Lines changed: 29 additions & 15 deletions

File tree

engine/src/java/com/runrev/android/nativecontrol/ExtVideoView.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ private void attachMediaController() {
328328
(View)this.getParent() : this;
329329
mMediaController.setAnchorView(anchorView);
330330
mMediaController.setEnabled(isInPlaybackState());
331+
332+
// PM-2015-10-19: [[ Bug 16027 ]] Make sure the controller shows/hides when changing its visibility on demand
333+
if (isInPlaybackState())
334+
mMediaController.show(0);
331335
}
332336
}
333337

@@ -369,7 +373,13 @@ public void onPrepared(MediaPlayer mp) {
369373
}
370374
if (mMediaController != null) {
371375
mMediaController.setEnabled(true);
376+
377+
// PM-2015-10-19: [[ Bug 16027 ]] Show the controller once the player is prepared (as on iOS)
378+
if (isInPlaybackState()){
379+
mMediaController.show(0);
380+
}
372381
}
382+
373383
mVideoWidth = mp.getVideoWidth();
374384
mVideoHeight = mp.getVideoHeight();
375385

@@ -390,10 +400,6 @@ public void onPrepared(MediaPlayer mp) {
390400
// start the video here instead of in the callback.
391401
if (mTargetState == STATE_PLAYING) {
392402
start();
393-
if (mMediaController != null) {
394-
// PM-2015-10-08: [[ Bug 16027 ]] Make sure the controller does not disappear after some ms of inactivity
395-
mMediaController.show(0);
396-
}
397403
} else if (!isPlaying() &&
398404
(seekToPosition != 0 || getCurrentPosition() > 0)) {
399405
if (mMediaController != null) {
@@ -407,10 +413,6 @@ public void onPrepared(MediaPlayer mp) {
407413
// The video size might be reported to us later.
408414
if (mTargetState == STATE_PLAYING) {
409415
start();
410-
// show the controller when starting playing a remote video
411-
if (mMediaController != null) {
412-
mMediaController.show(0);
413-
}
414416
}
415417
}
416418
}
@@ -542,10 +544,7 @@ public void surfaceChanged(SurfaceHolder holder, int format,
542544
seekTo(mSeekWhenPrepared);
543545
}
544546
start();
545-
if (mMediaController != null) {
546-
mMediaController.show(0);
547-
}
548-
}
547+
}
549548
}
550549

551550
public void surfaceCreated(SurfaceHolder holder)
@@ -626,7 +625,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event)
626625
keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
627626
if (mMediaPlayer.isPlaying()) {
628627
pause();
629-
mMediaController.show(0);
628+
mMediaController.show(0);
630629
} else {
631630
start();
632631
mMediaController.hide();
@@ -635,7 +634,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event)
635634
} else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP
636635
&& mMediaPlayer.isPlaying()) {
637636
pause();
638-
mMediaController.show(0);
637+
mMediaController.show(0);
639638
} else {
640639
toggleMediaControlsVisiblity();
641640
}
@@ -659,6 +658,12 @@ public void start() {
659658
mCurrentState = STATE_PLAYING;
660659
}
661660
mTargetState = STATE_PLAYING;
661+
662+
// PM-2015-10-19: [[ Bug 16027 ]] Show the controller here, to make sure it is enabled even if
663+
// mobileControlDo sPlayerId, "play" is called from a callback message
664+
if (mMediaController != null) {
665+
mMediaController.show(0);
666+
}
662667
}
663668

664669
public void stop() {

engine/src/java/com/runrev/android/nativecontrol/VideoControl.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import android.view.*;
2424
import android.widget.*;
2525

26+
2627
import java.io.*;
2728

2829
public class VideoControl extends NativeControl
@@ -43,7 +44,15 @@ public View createView(Context context)
4344
{
4445
m_video_view = new ExtVideoView(context);
4546

46-
m_video_controller = new MediaController(context);
47+
m_video_controller = new MediaController(context){
48+
// PM-2015-10-19: [[ Bug 16027 ]] Make sure the controller does not disappear every
49+
// time a control (i.e. Pause button) is clicked. This happened because when touching
50+
// the controls, MediaController called show(sDefaultTimeout);
51+
@Override
52+
public void show(int timeout) {
53+
super.show(0);
54+
}
55+
};
4756
m_video_view.setMediaController(m_video_controller);
4857

4958
setOnCompletionListener(new MediaPlayer.OnCompletionListener() {

0 commit comments

Comments
 (0)