add more debug statements to BasePlayer

This commit is contained in:
Christian Schabesberger 2018-08-18 14:11:41 +02:00
parent 44a71d8565
commit 98c65fb9b7
3 changed files with 13 additions and 4 deletions

View file

@ -25,12 +25,10 @@ public class ExtSDDownloadFailedActivity extends AppCompatActivity {
.setTitle(R.string.download_to_sdcard_error_title)
.setMessage(R.string.download_to_sdcard_error_message)
.setPositiveButton(R.string.yes, (DialogInterface dialogInterface, int i) -> {
NewPipeSettings.resetDownloadFolders(this);
finish();
})
.setNegativeButton(R.string.cancel, (DialogInterface dialogInterface, int i) -> {
dialogInterface.dismiss();
finish();
})

View file

@ -69,6 +69,7 @@ import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.player.playqueue.PlayQueueAdapter;
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
import org.schabi.newpipe.player.resolver.MediaSourceTag;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.util.ImageDisplayConstants;
import org.schabi.newpipe.util.SerializedCache;
@ -86,6 +87,7 @@ import static com.google.android.exoplayer2.Player.DISCONTINUITY_REASON_INTERNAL
import static com.google.android.exoplayer2.Player.DISCONTINUITY_REASON_PERIOD_TRANSITION;
import static com.google.android.exoplayer2.Player.DISCONTINUITY_REASON_SEEK;
import static com.google.android.exoplayer2.Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT;
import static org.schabi.newpipe.report.UserAction.PLAY_STREAM;
/**
* Base for the players, joining the common properties
@ -363,7 +365,10 @@ public abstract class BasePlayer implements
try {
context.unregisterReceiver(broadcastReceiver);
} catch (final IllegalArgumentException unregisteredException) {
Log.e(TAG, "Broadcast receiver already unregistered.", unregisteredException);
ErrorActivity.reportError(context, unregisteredException, null, null,
ErrorActivity.ErrorInfo.make(PLAY_STREAM,
"none",
"play stream", R.string.general_error));
}
}
@ -1001,6 +1006,8 @@ public abstract class BasePlayer implements
try {
metadata = (MediaSourceTag) simpleExoPlayer.getCurrentTag();
} catch (IndexOutOfBoundsException | ClassCastException error) {
if(DEBUG) Log.d(TAG, "Could not update metadata: " + error.getMessage());
if(DEBUG) error.printStackTrace();
return;
}
@ -1087,6 +1094,9 @@ public abstract class BasePlayer implements
return simpleExoPlayer.isCurrentWindowDynamic();
} catch (@NonNull IndexOutOfBoundsException ignored) {
// Why would this even happen =(
// But lets log it anyway. Save is save
if(DEBUG) Log.d(TAG, "Could not update metadata: " + ignored.getMessage());
if(DEBUG) ignored.printStackTrace();
return false;
}
}

View file

@ -15,7 +15,8 @@ public enum UserAction {
REQUESTED_CHANNEL("requested channel"),
REQUESTED_PLAYLIST("requested playlist"),
REQUESTED_KIOSK("requested kiosk"),
DELETE_FROM_HISTORY("delete from history");
DELETE_FROM_HISTORY("delete from history"),
PLAY_STREAM("Play stream");
private final String message;