Cast module cleanup

PiperOrigin-RevId: 402259951
This commit is contained in:
olly 2021-10-11 12:29:26 +01:00 committed by Oliver Woodman
parent e160649d9c
commit 63844a58fe
4 changed files with 22 additions and 15 deletions

View File

@ -1,9 +1,7 @@
# ExoPlayer Cast extension
# Cast module
## Description
The cast extension is a [Player][] implementation that controls playback on a
Cast receiver app.
This module provides a [Player][] implementation that controls a Cast receiver
app.
[Player]: https://exoplayer.dev/doc/reference/index.html?com/google/android/exoplayer2/Player.html
@ -25,5 +23,14 @@ locally. Instructions for doing this can be found in the [top level README][].
## Using the module
Create a `CastPlayer` and use it to integrate Cast into your app using
ExoPlayer's common `Player` interface.
Create a `CastPlayer` and use it to control a Cast receiver app. Since
`CastPlayer` implements the `Player` interface, it can be passed to all media
components that accept a `Player`, including the UI components provided by the
UI module.
## Links
* [Javadoc][]: Classes matching `com.google.android.exoplayer2.ext.cast.*` belong to this
module.
[Javadoc]: https://exoplayer.dev/doc/reference/index.html

View File

@ -1322,7 +1322,7 @@ public final class CastPlayer extends BasePlayer {
currentWindowIndex = timeline.getIndexOfPeriod(currentItem.getItemId());
}
if (currentWindowIndex == C.INDEX_UNSET) {
// The timeline is empty. Fall back to index 0, which is what ExoPlayer would do.
// The timeline is empty. Fall back to index 0.
currentWindowIndex = 0;
}
return currentWindowIndex;

View File

@ -22,7 +22,7 @@ import com.google.android.gms.cast.CastStatusCodes;
import com.google.android.gms.cast.MediaInfo;
import com.google.android.gms.cast.MediaTrack;
/** Utility methods for ExoPlayer/Cast integration. */
/** Utility methods for Cast integration. */
/* package */ final class CastUtils {
/** The duration returned by {@link MediaInfo#getStreamDuration()} for live streams. */

View File

@ -167,16 +167,16 @@ public final class DefaultMediaItemConverter implements MediaItemConverter {
return null;
}
JSONObject exoPlayerConfigJson = new JSONObject();
exoPlayerConfigJson.put("withCredentials", false);
exoPlayerConfigJson.put("protectionSystem", drmScheme);
JSONObject playerConfigJson = new JSONObject();
playerConfigJson.put("withCredentials", false);
playerConfigJson.put("protectionSystem", drmScheme);
if (drmConfiguration.licenseUri != null) {
exoPlayerConfigJson.put("licenseUrl", drmConfiguration.licenseUri);
playerConfigJson.put("licenseUrl", drmConfiguration.licenseUri);
}
if (!drmConfiguration.licenseRequestHeaders.isEmpty()) {
exoPlayerConfigJson.put("headers", new JSONObject(drmConfiguration.licenseRequestHeaders));
playerConfigJson.put("headers", new JSONObject(drmConfiguration.licenseRequestHeaders));
}
return exoPlayerConfigJson;
return playerConfigJson;
}
}