Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last Frame of first video is overlapping on second video #3160

Closed
vishnuganta22 opened this issue Aug 9, 2017 · 17 comments
Closed

Last Frame of first video is overlapping on second video #3160

vishnuganta22 opened this issue Aug 9, 2017 · 17 comments

Comments

@vishnuganta22
Copy link

*** ISSUES THAT IGNORE THIS TEMPLATE WILL BE CLOSED WITHOUT INVESTIGATION ***

Before filing an issue:

  • Search existing issues, including issues that are closed.
  • Consult our FAQs, supported devices and supported formats pages. These can be
    found at https://google.github.io/ExoPlayer/.
  • Rule out issues in your own code. A good way to do this is to try and
    reproduce the issue in the ExoPlayer demo app.
  • This issue tracker is intended for bugs, feature requests and ExoPlayer
    specific questions. If you're asking a general Android development question,
    please do so on Stack Overflow.

When reporting a bug:

Fill out the sections below, leaving the headers but replacing the content. If
you're unable to provide certain information, please explain why in the relevant
section. We may close issues if they do not include sufficient information.

Issue description

Describe the issue in detail, including observed and expected behavior.

Reproduction steps

Describe how the issue can be reproduced, ideally using the ExoPlayer demo app.

Link to test content

Provide a link to media that reproduces the issue. If you don't wish to post it
publicly, please submit the issue, then email the link to
dev.exoplayer@gmail.com including the issue number in the subject line.

Version of ExoPlayer being used

Specify the absolute version number. Avoid using terms such as "latest".

Device(s) and version(s) of Android being used

Specify the devices and versions of Android on which the issue can be
reproduced, and how easily it reproduces. If possible, please test on multiple
devices and Android versions.

A full bug report captured from the device

Capture a full bug report using "adb bugreport". Output from "adb logcat" or a
log snippet is NOT sufficient. Please attach the captured bug report as a file.
If you don't wish to post it publicly, please submit the issue, then email the
bug report to dev.exoplayer@gmail.com including the issue number in the subject
line.

@vishnuganta22
Copy link
Author

vishnuganta22 commented Aug 9, 2017

please test it on my exoplayer demo application (https://github.com/vishnuganta22/exoPlayerDemo)
while testing using my application please place two video with name's 1.mp4 and 2.mp4 in Download directory

Please let me know if you find any work around this issue

@ojw28
Copy link
Contributor

ojw28 commented Aug 9, 2017

This issue is being closed because it does not adhere to our issue template, and/or because it omits information requested in the issue template that is required for us to investigate the problem efficiently. The issue template can be found here.

If you’re able to provide complete information as requested in the issue template, please do so below and we’ll re-open the issue. Thanks!

@rohit5ram
Copy link

@ojw28 @andrewlewis We have faced the same issue. We have a player application which needs to loop a slideshow of videos. The views are dynamically constructed based on the dimension config and then attached. The first video may need to play in a full screen and the second one might play in 500 * 500 square.
For every file playback, a new SimpleExoPlayerView and new Player instances are created. The previous player instance is stopped and released.

The last frame of the first video appears as a static image in the second player view and the second video continues playing only the audio.

Everything absolutely works using android videoview and media player. We are planning to migrate to ExoPlayer and stuck with this issue. Can you please help us out?

@vishnuganta22
Copy link
Author

vishnuganta22 commented Aug 10, 2017

@ojw28 and @andrewlewis

Issue description

While playing multiple videos in SimpleExoplayerView using different dimension configs, the last frame of the first video is overlapping on the second video, But Still, we are able to hear the audio of the second video.

Reproduction steps

1.Play a video in SimpleExoplayerView [Width: 100% and Height: 100 %] and after the video is completed release the player and change the visibility view to GONE.

2.play another video in a new SimpleExolayerView with different dimensions may be [Width: 50% and Height: 100%] then you will see the last frame of the first video being overlapped on the second video
But still, you can able to hear the audio of the second video

Link to test content

My Demo Application source code is available in this link https://github.com/vishnuganta22/exoPlayerDemo

If you try installing my demo application on your device then you need to place any two videos named 1.mp4 and 2.mp4 in Downloads Folder. I have also screen recorded my device. You can watch this video for a better understanding of the behavior https://vimeo.com/229082192

Version of ExoPlayer being used

Exoplayer Version: r2.5.1

Device(s) and version(s) of Android being used

Android Version: 5.1.1

Device: Minix Neo X9

@vishnuganta22
Copy link
Author

@ojw28 Can you please reopen the issue?

@andrewlewis andrewlewis reopened this Aug 10, 2017
@andrewlewis
Copy link
Collaborator

The description is quite hard to follow and we don't really have time to debug your application's code for managing views/players. It sounds like something is getting reused in the second playback (a view or player).

Please could you provide a minimal patch to the ExoPlayer demo app that reproduces the issue?

@vishnuganta22
Copy link
Author

vishnuganta22 commented Aug 10, 2017

@andrewlewis Thanks for reopening the issue. I will try to send a patch on your demo app

Here is the clear problem description,

The application needs to play a slideshow of items. The item types are video and a custom designed view template which can have a slideshow within.
This is how it's implemented -
The layout has a dedicated main SimpleExoPlayerView which can play videos.
The template is constructed dynamically(new relative layout with a SimpleExoPlayer and some other views) and attached to the main layout on demand.

The visibility of the main SimpleExoPlayerView is reset as below before attaching the template view.

public static void resetSimpleExoPlayerView(@NonNull SimpleExoPlayerView videoView) { ExoPlayer player = videoView.getPlayer(); if (player != null) { player.stop(); player.release(); videoView.setPlayer(null); } videoView.setBackground(null); videoView.setVisibility(View.GONE); }

Whenever the template view is active (attached and visible) the new exoplayer view instead of playing the respective slideshow video, it just shows up the previos main video last frame and only play the audio.

Please watch this recorded video https://vimeo.com/229082192

@rohit5ram
Copy link

rohit5ram commented Aug 10, 2017

@andrewlewis @vishnuganta22 Adding this line to resetSimplExoPlayerView() method have solved the issue.

videoView.getVideoSurfaceView().setVisibility(GONE)

But at the start of playback the video region flickers in black colour on every transition which is a little noise for the user.

@andrewlewis
Copy link
Collaborator

Are you saying that simpleExoPlayerView.setVisibility(View.GONE); doesn't hide the first player, but simpleExoPlayerView.getVideoSurfaceView().setVisibility(View.GONE) does hide it?

For the flickering issue, I wonder whether this is due to the shutter background color (see #3172).

@vishnuganta22
Copy link
Author

@andrewlewis setting simpleExoPlayerView.getVideoSurfaceView().setVisibility(View.GONE) fixed our issue

@rohit5ram
Copy link

@andrewlewis may be setVisibility() of SimpleExoPlayerView should be overridden such that simpleExoPlayerView.setVisibility(View.GONE); will setVisibility to the whole viewgroup

@andrewlewis
Copy link
Collaborator

simpleExoPlayerView is a parent of the SurfaceView, so the SurfaceView should be hidden when you hide its parent player view (hiding a view group hides its children). This is the behavior I see in the demo app if I hide the player view, but it's not consistent with the behavior you've described.

If you snapshot the view hierarchy after hiding the player view do you see its child SurfaceView still set to be visible?

@ecorengia
Copy link

Able to replicate the same issue on Android 7.0 using a Moto G5 plus. Same version of Exoplayer.

@ojw28
Copy link
Contributor

ojw28 commented Sep 5, 2017

Please could someone provide a simple patch to our demo app that makes it possible to reproduce the problem (without us spending a lot of effort)? It definitely shouldn't be necessary to manually set the visibility of the child video surface.

@vishnuganta22
Copy link
Author

@ojw28 @andrewlewis
Made a simple patch on your demo App link

Steps to Reproduce on DemoApp
1.Just play the Custom Playlist

@ojw28
Copy link
Contributor

ojw28 commented Sep 6, 2017

I can reproduce this, thanks. This looks like a platform bug related to SurfaceView, since it doesn't reproduce using TextureView. It also doesn't reproduce on a device I have running Oreo, so I'm guessing it's been fixed. was fixed in the platform.

We'll add a workaround that explicitly propagates the visibility set on SimpleExoPlayerView to its child surfaceView (which is identical to what you're doing, but done internally).

ojw28 added a commit that referenced this issue Sep 6, 2017
This appears to be fixed in Oreo, but given how harmless
the workaround is we can probably just apply it on all
API levels to be sure.

Issue: #3160

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167709070
@ojw28 ojw28 closed this as completed Sep 6, 2017
ojw28 added a commit that referenced this issue Sep 6, 2017
This appears to be fixed in Oreo, but given how harmless
the workaround is we can probably just apply it on all
API levels to be sure.

Issue: #3160

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167709070
ojw28 added a commit that referenced this issue Sep 9, 2017
This appears to be fixed in Oreo, but given how harmless
the workaround is we can probably just apply it on all
API levels to be sure.

Issue: #3160

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167709070
hishamMuneer added a commit to hishamMuneer/ExoPlayer that referenced this issue Sep 14, 2017
* Minimal change to expose segment indices in DefaultDashChunkSource

Issue: google#3037

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164614478

* Clean up terminology for MediaSession extension

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164705750

* Fix minor Javadoc error

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164706078

* Document usage of the RTMP extension

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164706135

* set mediaSession flags properly and keep queue in sync when timeline changes

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164774783

* Support multiple video/text/metadata outputs

We've seen more than one issue filed where a developer has
registered a video listener and been confused by the fact
their SimpleExoPlayerView no longer works properly. There
are also valid use cases for having multiple metadata/text
outputs.

Issue: google#2933
Issue: google#2800
Issue: google#2286
Issue: google#2240

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164839882

* Fix maskingX variables when timeline becomes empty

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164840037

* Restrict usage of secure DummySurface for all Samsung devices.

* Support H262 video in MP4

* Fix possible subrip timing line NPE

* Support crop mode for AspectRatioFrameLayout

* Add flag to CachedContentIndex to disable encryption.  This allows the encryption feature
to be disabled gracefully: encrypted index files may be read, but plaintext will be written.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165196508

* Disable secure dummy surface on all Samsung N devices

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165291627

* Update instructions to include Google Maven repository

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165291982

* Destroy GL context when releasing dummy surface

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165293386

* Restore the interrupted flag after blocking operations

If the main thread was interrupted during
ExoPlayerImplInternal.blockingSendMessage/release, the interrupted flag was
immediately set but then wait() was called on the next iteration. wait() would
immediately throw InterruptedException, causing the main thread to spin until
the blocking operation completed.

Instead of resetting the flag immediately, reset it after the blocking
operation completes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165426493

* Work around issue with Xiaomi JB devices

Issue: google#3171

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165577562

* Improve FORMAT_UNSUPPORTED_DRM related documentation and logging

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165580016

* Improve MediaSource/MediaPeriod documentation

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165628229

* expose setPropertyByteArray, setPropertyString

export setPropertyByteArray, setPropertyString of DefaultDrmSessionManager for easy customization.

* Minor style tweaks

* Allow the app to specify extra ad markers

Issue: google#3184

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165895259

* Remove isFirstWindow/isLastWindow from Timeline.

These methods are only used in one place, and offer duplicate
functionality to checking getNext(Previous)WindowIndex == C.INDEX_UNSET.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165910258

* Fix broken link + minor doc tweak

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165920927

* Handle size==0 in MP4 atoms

Issue: google#3191

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165925148

* Use flavorDimensions for external demo app

- This is soon becoming mandatory.
- It also looks like future versions of com.android.tools.build
  are being distributed via Google's Maven repository.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166058299

* Support aspect ratio fill mode for AspectRatioFrameLayout

* Support zoom mode for AspectRatioFrameLayout

* Allow subclasses to customize the MediaFormat

Make getMediaFormat protected so that subclasses can set additional MediaFormat
keys. For example, if the decoder output needs to be read back via an
ImageReader as YUV data it is necessary to set KEY_COLOR_FORMAT to
COLOR_FormatYUV420Flexible.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166195211

* Use Math.abs in Sonic.java

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166820970

* Add support for new codecs parameter string

* google#3215 Additional secure DummySurface device exclusions

* Use UTF-8 everywhere

UTF-8 is the default charset on Android so this should be a no-op change, but
makes the code portable (in case it runs on another platform).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167011583

* Fix ContentDataSource bytesRemaining calculation

The bytesRemaining didn't always take into account any skipped bytes, which
meant that reaching the end of the file was not correctly detected in read().

Issue: google#3216

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167016672

* Allow more aggressive switching for HLS with independent segments

We currently switch without downloading overlapping segments, but
we do not actually switch more aggressively. This change fixes
this. Note there's an implicit assumption made that if one media
playlist declares independent segments, the others will too. This
is almost certainly true in practice, and if it's not the penalty
isn't too bad (the player may try and switch to a higher quality
variant one segment's worth of buffer too soon).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167120992

* HDR 10 bits: Use a separate sampler for U and V dithering.
Using the same sampler introduced some minor horizontal scratches.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167347995

* Fix typo

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167474040

* Minor cleanup to AspectRatioFrameLayout

* Update moe eqiuvalence

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167488837

* Allow EXIF tracks to be exposed

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167493800

* Adding missing license header in IMA build.gradle

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167496569

* Additional secure DummySurface device exclusions

Merge: google#3225

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167502127

* Be robust against unexpected EOS in WebvttCueParser

Issue: google#3228

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167504122

* Rewrite logic for enabling secure DummySurface

Issue: google#3215

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167505797

* Upgrade gradle plugin / wrapper

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167579719

* Don't use MediaCodec.setOutputSurface on Nexus 7 with qcom decoder

Issue: google#3236

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167581198

* Fix position reporting during ads when period has non-zero window offset.

Reporting incorrect positions for ad playbacks was causing IMA to
think the ad wasn't playing, when in fact it was.

Issue: google#3180

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167702032

* Workaround for SurfaceView not being hidden properly

This appears to be fixed in Oreo, but given how harmless
the workaround is we can probably just apply it on all
API levels to be sure.

Issue: google#3160

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167709070

* DecryptionException cleanup + add missing header

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167711928

* Pick up rtmpClient fix

Issue: google#3156

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167718081

* Enable rtmp in external demo app with extensions

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168007345

* Destroy EGLSurface during DummySurface cleanup

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168020525

* Fix attr inheritance in SimpleExoPlayerView

When creating PlaybackControlView inside SimpleExoPlayerView,
we want certain attributes to be passed through. This lets you
set control attributes on the SimpleExoPlayerView directly. We
don't want all attributes to be propagated though; only our own
custom ones.

Not sure if there's a cleaner way to do this. Pragmatically this
solution seems ... ok :)?

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167619801

* Add possibility of forcing a specific license URL in HttpMediaDrmCallback

Resubmit of google#3136

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164971900

* Fix build for release

* Bump to 2.5.2

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168155713

* Update extension README with usage instructions

Issue: google#3162

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165572088

* Tweak and add READMEs + remove refs to V1

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165578518

* Update README.md
@UgglyNoodle
Copy link

This fix actually caused a problem in my app. I have a still ImageView and an SimpleExoPlayerView. When a video has loaded (onPlayerStateChanged with STATE_READY), the still image is hidden and the video is displayed.

imageView.setVisibility(GONE);
simpleExoPlayerView.setVisibility(View.VISIBLE);
simpleExoPlayer.setPlayWhenReady(true);

When the user navigates to the next video, the video is hidden and the still image is displayed.

simpleExoPlayerView.setVisibility(View.GONE);
imageView.setVisibility(VISIBLE);

This repeats for every video.

With ExoPlayer r2.5.1, the transitions between the still image and the video are seamless. WIth r2.5.2+, there is a black flash for a frame or so when hiding the image and displaying the video.

This black flash is caused by the workaround aboe for this issue. I can fix the black flash by changing the second code block above to the following:

simpleExoPlayerView.setVisibility(View.GONE);
simpleExoPlayerView.getVideoSurfaceView().setVisibility(View.VISIBLE);
imageView.setVisibility(VISIBLE);

@google google locked and limited conversation to collaborators Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants