mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-19 08:14:54 +00:00
-Error processing for failed video during queued playback.
This commit is contained in:
parent
5c01f04a07
commit
40b60e8313
@ -542,6 +542,8 @@ public abstract class BasePlayer implements Player.EventListener,
|
||||
@Override
|
||||
public void onPlayerError(ExoPlaybackException error) {
|
||||
if (DEBUG) Log.d(TAG, "onPlayerError() called with: error = [" + error + "]");
|
||||
playbackManager.report(error);
|
||||
|
||||
onError(error);
|
||||
}
|
||||
|
||||
@ -598,10 +600,9 @@ public abstract class BasePlayer implements Player.EventListener,
|
||||
channelName = info.uploader;
|
||||
|
||||
if (simpleExoPlayer.getCurrentWindowIndex() != windowIndex) {
|
||||
Log.e(TAG, "Rewinding to correct window");
|
||||
Log.w(TAG, "Rewinding to correct window");
|
||||
simpleExoPlayer.seekTo(windowIndex, windowPos);
|
||||
} else {
|
||||
Log.d(TAG, "Correct window");
|
||||
simpleExoPlayer.seekTo(windowPos);
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ public class MainVideoPlayer extends Activity {
|
||||
public void onError(Exception exception) {
|
||||
exception.printStackTrace();
|
||||
Toast.makeText(context, "Failed to play this video", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
//finish();
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -130,6 +130,19 @@ class MediaSourceManager {
|
||||
sync();
|
||||
}
|
||||
|
||||
void report(final Exception error) {
|
||||
// ignore error checking for now, just remove the current index
|
||||
if (error != null && !isBlocked) {
|
||||
doBlock();
|
||||
}
|
||||
|
||||
final int index = playQueue.getIndex();
|
||||
remove(index);
|
||||
playQueue.remove(index);
|
||||
tryUnblock();
|
||||
sync();
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
if (loadingReactor != null) loadingReactor.cancel();
|
||||
if (playQueueReactor != null) playQueueReactor.cancel();
|
||||
@ -140,7 +153,6 @@ class MediaSourceManager {
|
||||
disposables = null;
|
||||
}
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Event Reactor
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
@ -181,7 +193,7 @@ class MediaSourceManager {
|
||||
}
|
||||
|
||||
if (!isPlayQueueReady() && !isBlocked) {
|
||||
playbackListener.block();
|
||||
doBlock();
|
||||
playQueue.fetch();
|
||||
}
|
||||
if (playQueueReactor != null) playQueueReactor.request(1);
|
||||
@ -209,6 +221,11 @@ class MediaSourceManager {
|
||||
return getCurrentSourceIndex() != -1;
|
||||
}
|
||||
|
||||
private void doBlock() {
|
||||
playbackListener.block();
|
||||
isBlocked = true;
|
||||
}
|
||||
|
||||
private void tryUnblock() {
|
||||
if (isPlayQueueReady() && isCurrentIndexLoaded() && isBlocked) {
|
||||
isBlocked = false;
|
||||
@ -225,7 +242,7 @@ class MediaSourceManager {
|
||||
if (isCurrentIndexLoaded()) {
|
||||
sync();
|
||||
} else if (!isBlocked) {
|
||||
playbackListener.block();
|
||||
doBlock();
|
||||
}
|
||||
|
||||
load();
|
||||
|
Loading…
Reference in New Issue
Block a user