1598 Commits

Author SHA1 Message Date
olly
25e58f5f2a Remove deprecated Player track methods
getCurrentTrackGroups and getCurrentTrackSelections are
retained for now, but moved from Player to ExoPlayer, to
ease the transition for some application code that currently
uses these methods.

PiperOrigin-RevId: 430036355
2022-02-22 10:58:21 +00:00
olly
bdcc9ea163 Libopus Support For WebM DiscardPadding
PiperOrigin-RevId: 429364728
2022-02-18 15:03:02 +00:00
Ian Baker
87d8ca0af2 Reformat some javadoc 2022-02-18 15:02:33 +00:00
olly
c7ea8114e9 Move track type from TrackGroupInfo to TrackGroup
The track type is derived solely from the content. It does
not depend on any runtime properties such as the player's
capabilities of user track selection. Hence it belongs in
TrackGroup rather than TrackGroupInfo.

Note that this avoids TrackSelectionOverride from having to
re-derive the track type internally.

PiperOrigin-RevId: 429303312
2022-02-17 16:20:21 +00:00
aquilescanta
8151883d7a Depend on llvm-xy bin utils instead of GNU's binutils
NDK 23 removes GNU's bin utils. More info in
https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#binutils.

LLVM bin utils are available in all modern NDK versions.

#minor-release
Issue: google/ExoPlayer#9933
PiperOrigin-RevId: 429299806
2022-02-17 16:16:45 +00:00
olly
63104064ca Make sure native library loads use correct class loader
Merge of https://github.com/google/ExoPlayer/pull/9934

#minor-release

PiperOrigin-RevId: 429259055
2022-02-17 15:06:12 +00:00
bachinger
e296bf9197 Clear ad playback state map when AdsLoader is released
#minor-release

PiperOrigin-RevId: 429067634
2022-02-17 14:24:02 +00:00
bachinger
d419914989 Make AdsLoader.State implement Bundleable
This allows the AdsLoader.State to be stored in savedInstanceState

#minor-release

PiperOrigin-RevId: 429057697
2022-02-17 14:24:02 +00:00
bachinger
ecbd361492 Copy playback configuration when creating the content media item
#minor-release

PiperOrigin-RevId: 429006934
2022-02-17 14:24:02 +00:00
olly
8e7ab9c811 Add TracksInfo methods for track selection UI
We need TracksInfo.hasTracksOfType to determine which tabs to
display in TrackSelectionDialog.

We need TrackGroupInfo.isAdaptiveSupported to determine whether
to allow multiple selection (check boxes) or not (radio buttons).

PiperOrigin-RevId: 428793739
2022-02-17 14:24:02 +00:00
bachinger
1fcb4e8b0e Store ad playback state in AdsLoader for resume after backgrounding
#minor-release

PiperOrigin-RevId: 428763656
2022-02-17 14:24:02 +00:00
bachinger
0619a96fa2 Disable IMA SSAI DASH live streams for now
#minor-release

PiperOrigin-RevId: 428761508
2022-02-17 14:24:02 +00:00
bachinger
de3708ee12 Prevent adding multiple IMA SSAI media source instances to the playlist
Currently only a single instance of ImaServerSideAdInsertionMediaSource is
supported at the same time in a playlist. This change makes sure that an
attempt to add multiple instances is prevented by throwing a an exception.

#minor-release

PiperOrigin-RevId: 428743140
2022-02-17 14:24:02 +00:00
bachinger
13db1e739e Reset stream manager in AdsLoader.release()
This prevents a stack trace that is shown in the logs when the stream manager is
released after the activity was stopped. In this case the call to
`streamManager.destroy()` coming from `releaseSourceInternal()` of the media
source is too late and produces an error saying `Application attempted to call on
a destroyed WebView`. The error has no effect but it's nice to not have this
stack trace in the logs.

PiperOrigin-RevId: 428574231
2022-02-17 14:23:57 +00:00
bachinger
b15c5634e6 Make AdsLoader.addMediaSourceResources package private.
#minor-release

PiperOrigin-RevId: 428565444
2022-02-17 11:57:54 +00:00
bachinger
1e66483b3e Use content timeline to get ad group index and ad index in ad group
The timeline used to map ad groups to periods needs to report the original content period duration without subtracting the serverside inserted ad duration. When marking played ads in onPositionDiscontinuity, the public timeline has been used which crashed the app when the ads media source is playing on a window index different to zero (in a playlist).

#minor-release

PiperOrigin-RevId: 428465833
2022-02-17 11:37:38 +00:00
bachinger
a7b0202712 Resolve media period ids in multi-period windows
Ignorable ad periods are skipped to resolve the media period id with the
ad playback state of the resulting period. In case of a change in the period
position un-played ad periods are rolled forward to be played.

PiperOrigin-RevId: 428011116
2022-02-17 11:16:56 +00:00
olly
9f586d2bba Trim CodecDelay/PreSkip In New OpusDecoder Instances By Default
PiperOrigin-RevId: 427819209
2022-02-17 10:45:52 +00:00
olly
fd1e89dfa9 Fix incorrect parameter name
PiperOrigin-RevId: 427474975
2022-02-17 10:14:12 +00:00
tonihei
1e2345cffe Simplify StreamRequest.Builder to an Uri Builder and make it public
Right now, the option to build an IMA DAI URI programmatically is still
package-private. To simplify the process, we can remove the StreamRequest
wrapper and directly provide an URI builder.

The same class can provide some package-private helper methods to parse the
created URI.

#minor-release

PiperOrigin-RevId: 427445326
2022-02-17 10:07:01 +00:00
olly
d8a614c0a7 Include opusV2JNI Target In Non-Android Builds
Allow opusV2JNI to be built-for & included-in non-Android build targets by ifdef'ing out the liblog dependency. Also removed libz and libandroid dependencies.

PiperOrigin-RevId: 427269838
2022-02-09 10:24:21 +00:00
ibaker
3c50238d20 Remove deprecated CronetDataSource constructors
#minor-release

PiperOrigin-RevId: 427216911
2022-02-09 10:17:05 +00:00
tonihei
d04ecb3cb7 Remove deprecated EventListener
PiperOrigin-RevId: 427133817
2022-02-08 12:34:07 +00:00
tonihei
17050e8b59 Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 427131569
2022-02-08 12:34:06 +00:00
olly
7f6accd03a Fix For Sample-To-Bytes Calculation In OpusDecoder
Aligning the byte size calculation with the sizes defined in opus_jni.cc
for the `outputFloat=true` case

#minor-release

PiperOrigin-RevId: 427028982
2022-02-08 12:34:06 +00:00
olly
2db8807aac Revert of b19ced30c4c2853b09af3382b86f84c31b3a5af5
PiperOrigin-RevId: 426996878
2022-02-08 12:33:53 +00:00
olly
b946944eca Revert of cf1dcede591e3db5481ef578e0637e271be8f336
PiperOrigin-RevId: 426994820
2022-02-08 12:33:46 +00:00
olly
cf1dcede59 Remove deprecated EventListener
PiperOrigin-RevId: 426876984
2022-02-08 10:39:28 +00:00
ibaker
b19ced30c4 Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 426855255
2022-02-07 11:17:31 +00:00
ibaker
75932a0216 Mark all public 'rarely used' IntDefs as only TYPE_USE
This is a breaking change if the annotation itself is in use in Kotlin
code. It's judged that the IntDefs in this commit are unlikely to be
referred to often in Kotlin code. This is because they're either:
- Related to esoteric parts of the library, or
- In a common part of the library but only returned from methods (and
  never passed to callback methods).

A follow-up change will fix the positions of existing usages to match
this new config.

#minor-release

PiperOrigin-RevId: 426410237
2022-02-07 11:10:11 +00:00
ibaker
0c2e77daca Mark all non-public IntDefs as only TYPE_USE
This only changes IntDefs that cannot be used by apps because they're
either private or package-private.

A follow-up change will fix the positions of existing usages to match
this new config.

#minor-release

PiperOrigin-RevId: 426372273
2022-02-04 15:07:19 +00:00
ibaker
6a269baeed Redefine the SSAI URI format with an "ssai" scheme instead of "imadai"
This allows us to remove the IMA naming from DefaultMediaSourceFactory's
SSAI integration.

#minor-release

PiperOrigin-RevId: 426346456
2022-02-04 14:49:52 +00:00
ibaker
1391b7c65d Remove references to Player(Control)View from the dev guide
Remove most of the customisation documentation, since StyledPlayerView
isn't really designed to be customised as deeply as PlayerView.

Also remove most documentation around StyledPlayerControlView,
especially as a standalone controller class - since it doesn't work
well for this use-case.

#minor-release

PiperOrigin-RevId: 426090762
2022-02-04 10:09:40 +00:00
ibaker
032df64f15 Fix parameter comments
PiperOrigin-RevId: 425874534
2022-02-04 09:52:19 +00:00
bachinger
b911e2ee4e Mark played ads in multi-period VOD streams
#minor-release

PiperOrigin-RevId: 425842813
2022-02-04 09:30:57 +00:00
ibaker
4020f69596 Publish the ImaServerSideAdInsertionMediaSource
Issue: google/ExoPlayer#8213

#minor-release

PiperOrigin-RevId: 425381474
2022-02-02 10:04:32 +00:00
bachinger
bdd64ce6a1 Setup VOD cue points to fill them when loaded
This makes sure the number of ads in an ad group matches to the number of periods representing an ad group in a multi-period timeline. This makes it easier to accurately mark ads as played in multi-period windows which is needed to correctly prevent seeking over unplayed ads.

PiperOrigin-RevId: 425317085
2022-02-01 14:26:06 +00:00
olly
5d7641c6f1 Fix some lint warnings
PiperOrigin-RevId: 424383900
2022-01-28 09:37:06 +00:00
ibaker
a89a08f99f Reformat some README files
PiperOrigin-RevId: 424366617
2022-01-28 09:26:25 +00:00
olly
cc144f5875 Fix 1 ErrorProneStyle finding:
* @CryptoType is a TYPE_USE annotation, so should appear after modifiers and directly before the type.
  (see go/java-style#s4.8.5-annotations)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneStyle if the change looks generally problematic.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/media/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/media/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

Tested:
    Local presubmit tests passed.

PiperOrigin-RevId: 423821355
2022-01-25 19:49:34 +00:00
bachinger
121592a41d Include audio metadata with DefaultMediaItemConverter for Cast
This change adds more standard metadata fields to Cast metadata including the artwork URL that makes the cast device show the artwork in the Cast route dialog (https://screenshot.googleplex.com/uj4n4Jqd7it9bob) and the Cast device.

This change also discriminates between media with an audio MIME type and others. For audio MIME type the Cast metadata is set to MEDIA_TYPE_MUSIC_TRACK which changes the layout and shows artwork and additional audio meta data to be displayed (https://screenshot.googleplex.com/ASy3KDcsTdJDM2T).

Issue: google/ExoPlayer#9663
PiperOrigin-RevId: 422589957
2022-01-25 18:37:25 +00:00
ibaker
ba58be2c41 Add an anchor tag for the IMA compat URL in ImaAdsLoader javadoc
The naked URL is not hyperlinked by the javadoc compiler, meaning a user
is forced to awkwardly copy it into the address bar of their browser:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/ext/ima/ImaAdsLoader.html

#minor-release

PiperOrigin-RevId: 422320571
2022-01-17 14:27:04 +00:00
ibaker
103b170a56 Rename some references from PlayerView to LegacyPlayerView
These were missed in 46ab94bd41

These references will be re-written to PlayerView when exporting to
exoplayer2, so this commit results in some small reformatting changes.

Also fix a reference to LegacyPlayerControlView that should be
StyledPlayerControlView.

PiperOrigin-RevId: 420707706
2022-01-10 12:53:59 +00:00
bachinger
a8e44294ab Include mediaId when marshalling a MediaItem to JSON
When sending a MediaItem to a MediaSession with a Media3 MediaController important information is removed for privacy reason. To look up the fully populated MediaItem the mediaId is used as a key. Hence having the mediaId marhalled to the JSON representation that is sent to a Cast device enables app developers to use the same look up facilities.

#minor-release

PiperOrigin-RevId: 420022868
2022-01-07 16:35:12 +00:00
olly
a9edb207a3 Fix 1 ErrorProneStyle finding:
* @CryptoType is a TYPE_USE annotation, so should appear after modifiers and directly before the type.

PiperOrigin-RevId: 418814902
2022-01-04 17:17:13 +00:00
bachinger
aa467f52e4 Make sure CastPlayer calls onIsPlaying if required
Before this change we checked whether the playback state and playWhenReady have changed when the state from the cast device arrived. If we detected such a change we called the listener callback `onIsPlayingChanged`. However, in the case when `setPlayWhenReady(boolean)` is called on 'CastPlayer', we mask the change in `playWhenReady`, then send the play/pause request to the cast device and when the state from the cast device arrives we never detect a change because we have already masked `playWhenReady`.

This change now moves the check for `isPlaying` to the same place where the state and playWhenReady is updated, so we call the `onIsPlayingChanged` callback in either case, when masking or when a changed state from the server arrives.

Issue: google/ExoPlayer#9792
PiperOrigin-RevId: 418483509
2022-01-04 14:00:44 +00:00
ibaker
5e8d1eb7f3 Add MediaSource.Factory and deprecate MediaSourceFactory
This more closely matches the pattern we have for all implementations
except DefaultMediaSourceFactory (e.g. ProgressiveMediaSource.Factory)
and other factory interfaces like (Http)DataSource.Factory.

PiperOrigin-RevId: 417826803
2022-01-04 12:51:47 +00:00
ibaker
4bf7ffd9a7 Move ImaAdsLoader Player.Listener implementation to internal class
PiperOrigin-RevId: 416613846
2021-12-16 10:17:18 +00:00
bachinger
9316b4f49b Add helper method to split the AdPlaybackState
PiperOrigin-RevId: 416543473
2021-12-16 10:13:45 +00:00
bachinger
a92e48e5f8 Support IMA DAI streams for HLS
PiperOrigin-RevId: 414804513
2021-12-10 16:21:51 +00:00