Update developer guide to use non-deprecated symbols

#minor-release

PiperOrigin-RevId: 406347412
This commit is contained in:
ibaker 2021-10-29 13:40:08 +00:00 committed by tonihei
parent a0f8ac7503
commit 405b811454
4 changed files with 40 additions and 27 deletions

View File

@ -178,7 +178,10 @@ MediaItem preRollAd = MediaItem.fromUri(preRollAdUri);
MediaItem contentStart =
new MediaItem.Builder()
.setUri(contentUri)
.setClipEndPositionMs(120_000)
.setClippingConfiguration(
new ClippingConfiguration.Builder()
.setEndPositionMs(120_000)
.build())
.build();
// A mid-roll ad.
MediaItem midRollAd = MediaItem.fromUri(midRollAdUri);
@ -186,7 +189,10 @@ MediaItem midRollAd = MediaItem.fromUri(midRollAdUri);
MediaItem contentEnd =
new MediaItem.Builder()
.setUri(contentUri)
.setClipStartPositionMs(120_000)
.setClippingConfiguration(
new ClippingConfiguration.Builder()
.setStartPositionMs(120_000)
.build())
.build();
// Build the playlist.

View File

@ -24,7 +24,8 @@ outlined in the sections below.
### Key rotation ###
To play streams with rotating keys, pass `true` to
`MediaItem.Builder.setDrmMultiSession` when building the media item.
`MediaItem.DrmConfiguration.Builder.setMultiSession` when building the media
item.
### Multi-key content ###
@ -49,8 +50,9 @@ to access the different streams.
In this case, the license server is configured to respond with only the key
specified in the request. Multi-key content can be played with this license
server configuration by passing `true` to `MediaItem.Builder.setDrmMultiSession`
when building the media item.
server configuration by passing `true` to
`MediaItem.DrmConfiguration.Builder.setMultiSession` when building the media
item.
We do not recommend configuring your license server to behave in this way. It
requires extra license requests to play multi-key content, which is less
@ -59,9 +61,9 @@ efficient and robust than the alternative described above.
### Offline keys ###
An offline key set can be loaded by passing the key set ID to
`MediaItem.Builder.setDrmKeySetId` when building the media item. This
allows playback using the keys stored in the offline key set with the specified
ID.
`MediaItem.DrmConfiguration.Builder.setKeySetId` when building the media item.
This allows playback using the keys stored in the offline key set with the
specified ID.
{% include known-issue-box.html issue-id="3872" description="Only one offline
key set can be specified per playback. As a result, offline playback of
@ -75,8 +77,9 @@ clear content as are used when playing encrypted content. When media contains
both clear and encrypted sections, you may want to use placeholder `DrmSessions`
to avoid re-creation of decoders when transitions between clear and encrypted
sections occur. Use of placeholder `DrmSessions` for audio and video tracks can
be enabled by passing `true` to `MediaItem.Builder.setDrmSessionForClearPeriods`
when building the media item.
be enabled by passing `true` to
`MediaItem.DrmConfiguration.Builder.forceSessionsForAudioAndVideoTracks` when
building the media item.
### Using a custom DrmSessionManager ###

View File

@ -89,7 +89,7 @@ components to support additional modes when playing live streams.
By default, ExoPlayer uses live playback parameters defined by the media. If you
want to configure the live playback parameters yourself, you can set them on a
per `MediaItem` basis by calling `MediaItem.Builder.setLiveXXX` methods. If
per `MediaItem` basis by calling `MediaItem.Builder.setLiveConfiguration`. If
you'd like to set these values globally for all items, you can set them on the
`DefaultMediaSourceFactory` provided to the player. In both cases, the provided
values will override parameters defined by the media.

View File

@ -86,17 +86,17 @@ To sideload subtitle tracks, `MediaItem.Subtitle` instances can be added when
when building a media item:
~~~
MediaItem.Subtitle subtitle =
new MediaItem.Subtitle(
subtitleUri,
MimeTypes.APPLICATION_SUBRIP, // The correct MIME type.
language, // The subtitle language. May be null.
selectionFlags); // Selection flags for the track.
MediaItem mediaItem = new MediaItem.Builder()
.setUri(videoUri)
.setSubtitles(Lists.newArrayList(subtitle))
.build();
MediaItem.SubtitleConfiguration subtitle =
new MediaItem.SubtitleConfiguration.Builder(subtitleUri)
.setMimeType(MimeTypes.APPLICATION_SUBRIP) // The correct MIME type (required).
.setLanguage(language) // The subtitle language (optional).
.setSelectionFlags(selectionFlags) // Selection flags for the track (optional).
.build();
MediaItem mediaItem =
new MediaItem.Builder()
.setUri(videoUri)
.setSubtitleConfigurations(ImmutableList.of(subtitle))
.build();
~~~
{: .language-java}
@ -110,11 +110,15 @@ It's possible to clip the content referred to by a media item by setting custom
start and end positions:
~~~
MediaItem mediaItem = new MediaItem.Builder()
.setUri(videoUri)
.setClipStartPositionMs(startPositionMs)
.setClipEndPositionMs(endPositionMs)
.build();
MediaItem mediaItem =
new MediaItem.Builder()
.setUri(videoUri)
.setClippingConfiguration(
new ClippingConfiguration.Builder()
.setStartPositionMs(startPositionMs)
.setEndPositionMs(endPositionMs)
.build())
.build();
~~~
{: .language-java}