Cast module cleanup
PiperOrigin-RevId: 402259951
This commit is contained in:
parent
e160649d9c
commit
63844a58fe
@ -1,9 +1,7 @@
|
|||||||
# ExoPlayer Cast extension
|
# Cast module
|
||||||
|
|
||||||
## Description
|
This module provides a [Player][] implementation that controls a Cast receiver
|
||||||
|
app.
|
||||||
The cast extension is a [Player][] implementation that controls playback on a
|
|
||||||
Cast receiver app.
|
|
||||||
|
|
||||||
[Player]: https://exoplayer.dev/doc/reference/index.html?com/google/android/exoplayer2/Player.html
|
[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
|
## Using the module
|
||||||
|
|
||||||
Create a `CastPlayer` and use it to integrate Cast into your app using
|
Create a `CastPlayer` and use it to control a Cast receiver app. Since
|
||||||
ExoPlayer's common `Player` interface.
|
`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());
|
currentWindowIndex = timeline.getIndexOfPeriod(currentItem.getItemId());
|
||||||
}
|
}
|
||||||
if (currentWindowIndex == C.INDEX_UNSET) {
|
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;
|
currentWindowIndex = 0;
|
||||||
}
|
}
|
||||||
return currentWindowIndex;
|
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.MediaInfo;
|
||||||
import com.google.android.gms.cast.MediaTrack;
|
import com.google.android.gms.cast.MediaTrack;
|
||||||
|
|
||||||
/** Utility methods for ExoPlayer/Cast integration. */
|
/** Utility methods for Cast integration. */
|
||||||
/* package */ final class CastUtils {
|
/* package */ final class CastUtils {
|
||||||
|
|
||||||
/** The duration returned by {@link MediaInfo#getStreamDuration()} for live streams. */
|
/** The duration returned by {@link MediaInfo#getStreamDuration()} for live streams. */
|
||||||
|
@ -167,16 +167,16 @@ public final class DefaultMediaItemConverter implements MediaItemConverter {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject exoPlayerConfigJson = new JSONObject();
|
JSONObject playerConfigJson = new JSONObject();
|
||||||
exoPlayerConfigJson.put("withCredentials", false);
|
playerConfigJson.put("withCredentials", false);
|
||||||
exoPlayerConfigJson.put("protectionSystem", drmScheme);
|
playerConfigJson.put("protectionSystem", drmScheme);
|
||||||
if (drmConfiguration.licenseUri != null) {
|
if (drmConfiguration.licenseUri != null) {
|
||||||
exoPlayerConfigJson.put("licenseUrl", drmConfiguration.licenseUri);
|
playerConfigJson.put("licenseUrl", drmConfiguration.licenseUri);
|
||||||
}
|
}
|
||||||
if (!drmConfiguration.licenseRequestHeaders.isEmpty()) {
|
if (!drmConfiguration.licenseRequestHeaders.isEmpty()) {
|
||||||
exoPlayerConfigJson.put("headers", new JSONObject(drmConfiguration.licenseRequestHeaders));
|
playerConfigJson.put("headers", new JSONObject(drmConfiguration.licenseRequestHeaders));
|
||||||
}
|
}
|
||||||
|
|
||||||
return exoPlayerConfigJson;
|
return playerConfigJson;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user