-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Adding m3u8 to ConcatenatingMediaSource stopped playback #4661
Comments
Can you please provide example media files to reproduce the issue? Also, please try to capture a bugreport (or copy the logcat) after the issue occurred. Thanks! |
@tonihei, thanks for the response! Yes of course, here are the test media(mp4 is loaded in the device storage): http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4 In fact, it does not matter what files, you can take any mp4 and m3u8. Logcat output
Code ...
private ConcatenatingMediaSource mConcatVideos;
public void preloadHLS(String path, int duration) {
try {
MediaSource source = buildMediaSource(Uri.parse(path));
if (mConcatVideos.getSize() == 0)
mConcatVideos = new ConcatenatingMediaSource();
mConcatVideos.addMediaSource(new ClippingMediaSource(source, 0,
TimeUnit.SECONDS.toMicros(duration)));
} catch (Exception ignore) {
println(ERROR, MediaView.class, "Problem preload stream: %s", path);
}
}
public void playMp4(String path) {
try {
if (mConcatVideos.getSize() == 0)
mConcatVideos = new ConcatenatingMediaSource();
MediaSource source = buildMediaSource(Uri.parse(path));
mConcatVideos.addMediaSource(source);
mPlayer.setPlayWhenReady(true);
mPlayer.prepare(mConcatVideos);
} catch (Exception ignored) {
println(ERROR, MediaView.class, "Problem play video: %s", path);
}
}
private MediaSource buildMediaSource(
Uri uri) {
int type = Util.inferContentType(uri);
switch (type) {
case C.TYPE_DASH:
return new DashMediaSource.Factory(
new DefaultDashChunkSource.Factory(mMediaDataSourceFactory),
buildDataSourceFactory())
.createMediaSource(uri);
case C.TYPE_SS:
return new SsMediaSource.Factory(
new DefaultSsChunkSource.Factory(mMediaDataSourceFactory),
buildDataSourceFactory())
.createMediaSource(uri);
case C.TYPE_HLS:
return new HlsMediaSource.Factory(mMediaDataSourceFactory)
.createMediaSource(uri);
case C.TYPE_OTHER:
return new ExtractorMediaSource.Factory(mMediaDataSourceFactory)
.createMediaSource(uri);
default: {
throw new IllegalStateException("Unsupported type: " + type);
}
}
}
... I call the ExoPlayer: 2.8.3 If anything, I can provide a demo app this problem. |
Unfortunately, I can't reproduce your problem. |
@tonihei, I continue to receive this problem, so I created demo app https://github.com/sneltyn/ExoPreload. Sorry for my long answer. |
Thanks for the example project! I can now reproduce the problem. I'll take a look and we'll provide a fix in the next release. |
… issues 1. Currently, we may throw source info refresh errors while the previous media period is still playing. 2. We don't throw if the next period in a playlist fails to prepare and the previous renderers are all disabled. 3. We throw source info refresh errors for playlists before playback reaches the culprit source. This change: 1. Defers the exceptions until all existing media periods have been played. 2. Checks for period preparation exception if the next period is not getting prepared and the renderer time reached the next period. 3. Does no longer throw from ConcatenatingMediaSource.maybeThrowSourceInfo RefreshError. The deferred media periods take care of that for each source individually. Issue:#4661 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=211819436
I use ConcatenatingMediaSource to play the video. After the first media mp4 is added, the second carrier m3u8 is added, and the Internet is disabled. I get the exception :
HttpDataSourceException: It is impossible to connect to ...
And the player stops the current playback of mp4.
How to ignore m3u8 in case it fails to load it?
The text was updated successfully, but these errors were encountered: