Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
63844a58
authored
Oct 11, 2021
by
olly
Committed by
Oliver Woodman
Oct 11, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Cast module cleanup
PiperOrigin-RevId: 402259951
parent
e160649d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
15 deletions
extensions/cast/README.md
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastUtils.java
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/DefaultMediaItemConverter.java
extensions/cast/README.md
View file @
63844a58
#
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][].
...
@@ -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
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastPlayer.java
View file @
63844a58
...
@@ -1322,7 +1322,7 @@ public final class CastPlayer extends BasePlayer {
...
@@ -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
;
...
...
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/CastUtils.java
View file @
63844a58
...
@@ -22,7 +22,7 @@ import com.google.android.gms.cast.CastStatusCodes;
...
@@ -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. */
...
...
extensions/cast/src/main/java/com/google/android/exoplayer2/ext/cast/DefaultMediaItemConverter.java
View file @
63844a58
...
@@ -167,16 +167,16 @@ public final class DefaultMediaItemConverter implements MediaItemConverter {
...
@@ -167,16 +167,16 @@ public final class DefaultMediaItemConverter implements MediaItemConverter {
return
null
;
return
null
;
}
}
JSONObject
exoP
layerConfigJson
=
new
JSONObject
();
JSONObject
p
layerConfigJson
=
new
JSONObject
();
exoP
layerConfigJson
.
put
(
"withCredentials"
,
false
);
p
layerConfigJson
.
put
(
"withCredentials"
,
false
);
exoP
layerConfigJson
.
put
(
"protectionSystem"
,
drmScheme
);
p
layerConfigJson
.
put
(
"protectionSystem"
,
drmScheme
);
if
(
drmConfiguration
.
licenseUri
!=
null
)
{
if
(
drmConfiguration
.
licenseUri
!=
null
)
{
exoP
layerConfigJson
.
put
(
"licenseUrl"
,
drmConfiguration
.
licenseUri
);
p
layerConfigJson
.
put
(
"licenseUrl"
,
drmConfiguration
.
licenseUri
);
}
}
if
(!
drmConfiguration
.
licenseRequestHeaders
.
isEmpty
())
{
if
(!
drmConfiguration
.
licenseRequestHeaders
.
isEmpty
())
{
exoP
layerConfigJson
.
put
(
"headers"
,
new
JSONObject
(
drmConfiguration
.
licenseRequestHeaders
));
p
layerConfigJson
.
put
(
"headers"
,
new
JSONObject
(
drmConfiguration
.
licenseRequestHeaders
));
}
}
return
exoP
layerConfigJson
;
return
p
layerConfigJson
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment