com.google.android.exoplayer2.ui.PlayerNotificationManager Java Examples

The following examples show how to use com.google.android.exoplayer2.ui.PlayerNotificationManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From lbry-android with MIT License 6 votes vote down vote up
@Nullable
@Override
public Bitmap getCurrentLargeIcon(Player player, PlayerNotificationManager.BitmapCallback callback) {
    if (nowPlayingClaimBitmap == null &&
            nowPlayingClaim != null &&
            !Helper.isNullOrEmpty(nowPlayingClaim.getThumbnailUrl())) {
        Glide.with(getApplicationContext()).asBitmap().load(nowPlayingClaim.getThumbnailUrl()).into(new CustomTarget<Bitmap>() {
            @Override
            public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                nowPlayingClaimBitmap = resource;
                callback.onBitmap(resource);
            }

            @Override
            public void onLoadCleared(@Nullable Drawable placeholder) {

            }
        });
    }
    return nowPlayingClaimBitmap;
}
 
Example #2
Source File: PersistentNotification.java    From media_player with MIT License 5 votes vote down vote up
void createNotification() {
    playerNotificationManager = PlayerNotificationManager.createWithNotificationChannel(service,
            PLAYBACK_CHANNEL_ID, R.string.playback_channel_name, PLAYBACK_NOTIFICATION_ID,
            new MyMediaDescriptionAdapter());

    playerNotificationManager.setNotificationListener(new MyNotificationListener());
    playerNotificationManager.setPlayer(vplayer.getPlayer());
}
 
Example #3
Source File: BackgroundPlayerService.java    From zapp with MIT License 5 votes vote down vote up
/**
 * As soon as somebody starts this service as background player, we create the
 * player notification. When created this notification will move the service to
 * foreground to avoid being destroyed by the system.
 */
private void handleStartInBackground() {
	isPlaybackInBackground = true;

	playerNotificationManager = new PlayerNotificationManager(this,
		NotificationHelper.BACKGROUND_PLAYBACK_CHANNEL_ID,
		NotificationHelper.BACKGROUND_PLAYBACK_NOTIFICATION_ID,
		this);
	playerNotificationManager.setOngoing(false);
	playerNotificationManager.setNotificationListener(this);
	playerNotificationManager.setSmallIcon(R.drawable.ic_zapp_tv);
	playerNotificationManager.setColor(getResources().getColor(R.color.colorPrimaryDark));
	playerNotificationManager.setPlayer(player.getExoPlayer());
	playerNotificationManager.setMediaSessionToken(player.getMediaSession().getSessionToken());
}
 
Example #4
Source File: BackgroundPlayerService.java    From zapp with MIT License 4 votes vote down vote up
@Override
public Bitmap getCurrentLargeIcon(com.google.android.exoplayer2.Player player, PlayerNotificationManager.BitmapCallback callback) {
	return null;
}