diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/Media.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/Media.java index 8bef8e632..270abbb2d 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/Media.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/Media.java @@ -15,6 +15,7 @@ public class Media implements MediaElement.Delegate { private double mPlaybackRate = 1.0f; private int mReadyState = MediaElement.MEDIA_READY_STATE_HAVE_NOTHING; private boolean mPlaying = false; + private boolean mWasPlayed = false; private boolean mEnded = false; private double mVolume = 1.0f; private boolean mIsMuted = false; @@ -68,6 +69,10 @@ public boolean isPlaying() { return mPlaying; } + public boolean isPlayed() { + return mWasPlayed; + } + public boolean isEnded() { return mEnded; } @@ -133,6 +138,7 @@ public void setResizeDelegate(ResizeDelegate aResizeDelegate) { @Override public void onPlaybackStateChange(MediaElement mediaElement, int playbackState) { if (playbackState == MediaElement.MEDIA_STATE_PLAY) { + mWasPlayed = true; mPlaying = true; } else if (playbackState == MediaElement.MEDIA_STATE_PAUSE) { mPlaying = false; diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TitleBarWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TitleBarWidget.java index afe4ede79..47d7ffd40 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TitleBarWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TitleBarWidget.java @@ -185,9 +185,11 @@ public void mediaAvailabilityChanged(boolean available) { if (available) { mMedia = mAttachedWindow.getSession().getFullScreenVideo(); if (mMedia != null) { - mBinding.setIsMediaAvailable(true); - mBinding.setIsMediaPlaying(mMedia.isPlaying()); mMedia.addMediaListener(mMediaDelegate); + if (mMedia.isPlayed()) { + mBinding.setIsMediaAvailable(true); + mBinding.setIsMediaPlaying(true); + } } } else { mBinding.setIsMediaAvailable(false);