kopia lustrzana https://github.com/TeamNewPipe/NewPipe
-Error processing for failed video during queued playback.
rodzic
5c01f04a07
commit
40b60e8313
|
@ -542,6 +542,8 @@ public abstract class BasePlayer implements Player.EventListener,
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerError(ExoPlaybackException error) {
|
public void onPlayerError(ExoPlaybackException error) {
|
||||||
if (DEBUG) Log.d(TAG, "onPlayerError() called with: error = [" + error + "]");
|
if (DEBUG) Log.d(TAG, "onPlayerError() called with: error = [" + error + "]");
|
||||||
|
playbackManager.report(error);
|
||||||
|
|
||||||
onError(error);
|
onError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,10 +600,9 @@ public abstract class BasePlayer implements Player.EventListener,
|
||||||
channelName = info.uploader;
|
channelName = info.uploader;
|
||||||
|
|
||||||
if (simpleExoPlayer.getCurrentWindowIndex() != windowIndex) {
|
if (simpleExoPlayer.getCurrentWindowIndex() != windowIndex) {
|
||||||
Log.e(TAG, "Rewinding to correct window");
|
Log.w(TAG, "Rewinding to correct window");
|
||||||
simpleExoPlayer.seekTo(windowIndex, windowPos);
|
simpleExoPlayer.seekTo(windowIndex, windowPos);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "Correct window");
|
|
||||||
simpleExoPlayer.seekTo(windowPos);
|
simpleExoPlayer.seekTo(windowPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,7 +326,7 @@ public class MainVideoPlayer extends Activity {
|
||||||
public void onError(Exception exception) {
|
public void onError(Exception exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
Toast.makeText(context, "Failed to play this video", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Failed to play this video", Toast.LENGTH_SHORT).show();
|
||||||
finish();
|
//finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -130,6 +130,19 @@ class MediaSourceManager {
|
||||||
sync();
|
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() {
|
void dispose() {
|
||||||
if (loadingReactor != null) loadingReactor.cancel();
|
if (loadingReactor != null) loadingReactor.cancel();
|
||||||
if (playQueueReactor != null) playQueueReactor.cancel();
|
if (playQueueReactor != null) playQueueReactor.cancel();
|
||||||
|
@ -140,7 +153,6 @@ class MediaSourceManager {
|
||||||
disposables = null;
|
disposables = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// Event Reactor
|
// Event Reactor
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
@ -181,7 +193,7 @@ class MediaSourceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPlayQueueReady() && !isBlocked) {
|
if (!isPlayQueueReady() && !isBlocked) {
|
||||||
playbackListener.block();
|
doBlock();
|
||||||
playQueue.fetch();
|
playQueue.fetch();
|
||||||
}
|
}
|
||||||
if (playQueueReactor != null) playQueueReactor.request(1);
|
if (playQueueReactor != null) playQueueReactor.request(1);
|
||||||
|
@ -209,6 +221,11 @@ class MediaSourceManager {
|
||||||
return getCurrentSourceIndex() != -1;
|
return getCurrentSourceIndex() != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doBlock() {
|
||||||
|
playbackListener.block();
|
||||||
|
isBlocked = true;
|
||||||
|
}
|
||||||
|
|
||||||
private void tryUnblock() {
|
private void tryUnblock() {
|
||||||
if (isPlayQueueReady() && isCurrentIndexLoaded() && isBlocked) {
|
if (isPlayQueueReady() && isCurrentIndexLoaded() && isBlocked) {
|
||||||
isBlocked = false;
|
isBlocked = false;
|
||||||
|
@ -225,7 +242,7 @@ class MediaSourceManager {
|
||||||
if (isCurrentIndexLoaded()) {
|
if (isCurrentIndexLoaded()) {
|
||||||
sync();
|
sync();
|
||||||
} else if (!isBlocked) {
|
} else if (!isBlocked) {
|
||||||
playbackListener.block();
|
doBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
Ładowanie…
Reference in New Issue