mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Never set null as a session meta data object.
Issue: #5810 PiperOrigin-RevId: 245745646
This commit is contained in:
parent
1fb128df36
commit
44ad47746a
1 changed files with 6 additions and 3 deletions
|
|
@ -146,6 +146,9 @@ public final class MediaSessionConnector {
|
||||||
private static final int EDITOR_MEDIA_SESSION_FLAGS =
|
private static final int EDITOR_MEDIA_SESSION_FLAGS =
|
||||||
BASE_MEDIA_SESSION_FLAGS | MediaSessionCompat.FLAG_HANDLES_QUEUE_COMMANDS;
|
BASE_MEDIA_SESSION_FLAGS | MediaSessionCompat.FLAG_HANDLES_QUEUE_COMMANDS;
|
||||||
|
|
||||||
|
private static final MediaMetadataCompat METADATA_EMPTY =
|
||||||
|
new MediaMetadataCompat.Builder().build();
|
||||||
|
|
||||||
/** Receiver of media commands sent by a media controller. */
|
/** Receiver of media commands sent by a media controller. */
|
||||||
public interface CommandReceiver {
|
public interface CommandReceiver {
|
||||||
/**
|
/**
|
||||||
|
|
@ -639,8 +642,8 @@ public final class MediaSessionConnector {
|
||||||
MediaMetadataCompat metadata =
|
MediaMetadataCompat metadata =
|
||||||
mediaMetadataProvider != null && player != null
|
mediaMetadataProvider != null && player != null
|
||||||
? mediaMetadataProvider.getMetadata(player)
|
? mediaMetadataProvider.getMetadata(player)
|
||||||
: null;
|
: METADATA_EMPTY;
|
||||||
mediaSession.setMetadata(metadata);
|
mediaSession.setMetadata(metadata != null ? metadata : METADATA_EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -888,7 +891,7 @@ public final class MediaSessionConnector {
|
||||||
@Override
|
@Override
|
||||||
public MediaMetadataCompat getMetadata(Player player) {
|
public MediaMetadataCompat getMetadata(Player player) {
|
||||||
if (player.getCurrentTimeline().isEmpty()) {
|
if (player.getCurrentTimeline().isEmpty()) {
|
||||||
return null;
|
return METADATA_EMPTY;
|
||||||
}
|
}
|
||||||
MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder();
|
MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder();
|
||||||
if (player.isPlayingAd()) {
|
if (player.isPlayingAd()) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue