Commit 63844a58 by olly Committed by Oliver Woodman

Cast module cleanup

PiperOrigin-RevId: 402259951
parent e160649d
# 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
......@@ -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;
......
......@@ -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. */
......
......@@ -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;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment