991 Commits

Author SHA1 Message Date
huangdarwin
6da70c842e Overlay: Rename alpha to alphaScale.
The actual logic scales the alpha, instead of setting it, so rename
this to what it does.

We would also prefer alpha to be scaled here, to not lose alpha information
(for example for PNGs with transparent regions).

PiperOrigin-RevId: 560121708
2023-08-25 10:00:50 -07:00
tonihei
7899241daf Fix period indexing for multi-period DASH DAI live streams
The period index was calculated relative to the contentTimeline
of the DAI stream, but then used with the full timeline of the
player. This means it currently only works when the stream is the
only or first item in the playlist.

Issue: androidx/media#571
PiperOrigin-RevId: 560023412
2023-08-25 02:05:46 -07:00
sheenachhabra
d5f8487fe2 Add pause and resume button in demo app
Currently the resume button will restart the export from
the beginning.

PiperOrigin-RevId: 559787856
2023-08-24 10:05:51 -07:00
tonihei
25cd13b3a2 Remove unused values
PiperOrigin-RevId: 559357691
2023-08-24 09:20:33 +01:00
ibaker
3ced1cbaa2 Update annotation-experimental version
This picks up a fix to ensure Android Studio puts the `@OptIn`
annotation in the correct place:
https://issuetracker.google.com/251172715

This also introduces a transitive dependency from `media3-common` on
the Kotlin standard library, so this CL also includes some updates to
the dev guide to document how apps can avoid including this dep if
they want.

PiperOrigin-RevId: 558821673
2023-08-22 15:40:46 +01:00
samrobinson
99ac6feeee Add varargs convenience constructors to Sequence & Composition.Builder
Improves API ease-of-use & readability and reduces verbose boilerplate.

PiperOrigin-RevId: 558163557
2023-08-22 15:17:55 +01:00
claincly
c6804e40a3 Display more accurate time in demo app
PiperOrigin-RevId: 558077709
2023-08-18 15:21:53 +01:00
ibaker
a48b99214e Enable @UnstableApi lint in session demo app and add needed @OptIn
PiperOrigin-RevId: 556779020
2023-08-14 17:19:58 +01:00
claincly
c1913e8d89 Deprecate SingleFrameShaderProgram
PiperOrigin-RevId: 555450958
2023-08-11 20:22:03 +00:00
ibaker
133bf29668 Add demo app test stream with overlapping SSA subtitles muxed in MKV
This doesn't currently work by default, but upcoming changes in
`TextRenderer` will make it work as expected.

Issue: google/ExoPlayer#10295
PiperOrigin-RevId: 553161628
2023-08-07 11:26:18 +00:00
samrobinson
fec6252065 Add basic volume scaling to the Transformer demo app.
PiperOrigin-RevId: 553086635
2023-08-07 11:23:14 +00:00
simakova
415b17c1e1 Allow an empty video effects array
PiperOrigin-RevId: 551829203
2023-08-01 14:21:20 +01:00
Googler
465e7c1277 Rewrite tracing to be more flexible and provide more info.
For each event, the timestamp and presentation time is logged. The trace can
then be dumped to a tsv file and easily imported in a spreadsheet.

PiperOrigin-RevId: 550839156
2023-08-01 13:59:51 +01:00
tofunmi
7eee15ecb4 Update OverlaySettings to explicitly state overlay transformations
Alters the OverlayShaderProgram implementation to support rotations, however we need to apply the transformations separately in order for them to work as expected so the matrix is removed from the interface in favour of explicit methods.

Adds a rotation test to ensure this ability doesn't regress

PiperOrigin-RevId: 549890847
2023-08-01 13:45:22 +01:00
ibaker
1ccedf8414 Tighten the demo app's handling of DrmInitData for downloads
This code is Widevine specific. `OfflineLicenseHelper.downloadLicense`
requires the passed `Format` to have a `DrmInitData.SchemeData` with
Widevine UUID and non-null `data` field. The demo app tries to check
this in advance (to avoid an exception later), but its checks are
looser than those made by `OfflineLicenseHelper`. This change tightens
the checks to match.

Issue: androidx/media#512
PiperOrigin-RevId: 549587506
2023-08-01 13:31:57 +01:00
tonihei
5c5e7cd257 Update storage access in main demo app
The main demo app was still targeting API 29 to avoid scoped storage
restrictions. It is now updated to 34 (like the rest of the demo apps)
and handles scoped storage as it should handle it.

More specifically:
 - We need to request READ_MEDIA_... permissions instead of
   READ_EXTERNAL_STORAGE from API33.
 - The legacy scoped storage opt-out can be removed
 - READ_MEDIA_... permissions don't allow arbitrary file access
   if the file doesn't end in a typical media file extension, so
   this change adds a remark on the guide page to place samples
   in the app-specific directory.
 - We also don't have to request permissions for the app-specific
   directories.
 - Custom json files can't be placed in arbitray local locations
   because they don't end in a media file extension, as there is
   no way we can request a permission to load them. This means we
   can remove the storage request logic in SampleChooserActivity.

Issue: google/ExoPlayer#6045
PiperOrigin-RevId: 549252474
2023-07-20 10:29:02 +01:00
tonihei
8064c6df83 Declare foreground service type for DownloadService
This ensures the DownloadService stays functional on Android 14
where defining this type is required. On Android 14 and above,
the app also needs to define the DATA_SYNC permission, which is
added to the demo app as well. In the future, this service type
will no longer be supported and DownloadService needs to be
rewritten with another background scheduling framework.

Issue: google/ExoPlayer#11239
PiperOrigin-RevId: 548994842
2023-07-20 10:23:56 +01:00
tonihei
2d3f464008 Update demo app target SDKs to 34
This helps to highlight and document new requirements for apps,
e.g. to add the FOREGROUND_SERVICE_MEDIA_PLAYBACK permission for
background playback.

Issue: google/ExoPlayer#11239
PiperOrigin-RevId: 548666056
2023-07-20 10:11:18 +01:00
samrobinson
aa1ca747de Add channel mixing effect to demo application.
PiperOrigin-RevId: 547465758
2023-07-13 15:52:43 +01:00
bachinger
ea21d27a69 Add custom layout to the state of the MediaController
This change also marks the buttons of the custom layout as
enabled/disabled according to available commands in the controller.
Accordingly, `CommandButton.Builder.setEnabled(boolean)` is deprecated
because the value is overridden by the library.

Issue: androidx/media#38

#minor-release

PiperOrigin-RevId: 547272588
2023-07-13 15:47:50 +01:00
andrewlewis
22b7a7dc39 Tidy handling of package not found exception in demo
PiperOrigin-RevId: 546900066
2023-07-13 15:34:37 +01:00
andrewlewis
bdbf3e29a1 Fix incorrect class name for MediaPipe demo
Issue: androidx/media#500

#minor-release

PiperOrigin-RevId: 545942450
2023-07-13 15:03:46 +01:00
Googler
5050171ff6 Rename "useHdr" to "useHighPrecisionColorComponents."
BaseGlShaderProgram and SingleFrameGlShaderProgram are technically color space agnostic. useHdr is passed to the TexturePool, which only uses the value to choose between high/regular precision. useHdr is therefore a bit misleading and should be generalized to "useHighPrecisionColorComponents."

PiperOrigin-RevId: 545726629
2023-07-13 14:56:37 +01:00
huangdarwin
7a368b9a11 Effect: Remove GlTextureInfo accessor methods.
The extra check was a bit excessive, especially as it's called multiple times
per frame.

PiperOrigin-RevId: 545657102
2023-07-13 14:51:38 +01:00
kimvde
81c83e4213 Remove HDR modes from TransformationRequest
PiperOrigin-RevId: 545352306
2023-07-05 09:16:52 +00:00
ibaker
5e96d355e1 Suppress NewApi lint warning on <vector> usage in drawables
PiperOrigin-RevId: 545207308
2023-07-05 09:08:51 +00:00
kimvde
b358d075a1 Replace usages of deprecated TransformationRequest setter
PiperOrigin-RevId: 543765376
2023-06-29 22:59:06 +00:00
andrewlewis
90c8f642af Pass GlObjectsProvider to methods
By passing this class where it's needed, implementations don't need to store it
in a field (reducing boilerplate) and it's clearer that it can't be unset when
needed.

PiperOrigin-RevId: 542823522
2023-06-23 16:49:12 +00:00
ibaker
8bf40e7355 Add a demo app sample of SubRip muxed into MKV
I created this by:
1. Downloading https://storage.googleapis.com/exoplayer-test-media-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv
2. Crafting a `test.srt` file with a text editor
3. Muxing them together:

   ```
   $ mkvmerge -o android-screens-with-subrip.mkv \
       android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv \
       test.srt
   ```

Tested in the demo app, the subtitle track is selected by default
(default behaviour for Matroska spec afaict).

PiperOrigin-RevId: 540577912
2023-06-19 16:15:43 +01:00
bachinger
bd97dd8519 Rollback of 7956c80f73
*** Original commit ***

Rollback of 2a6f893fba

*** Original commit ***

Set video size to 0/0 when video render is disabled

In terms of MCVR wi...

***

PiperOrigin-RevId: 540525069
2023-06-19 16:09:13 +01:00
tonihei
51fb72b00d Replace deprecated NullableType from checkerframework with our own one
The existing NullableType has been deprecated 5 years ago and causes
crashes in Kotlin apps because Kotlin doesn't recognize this annotation
as a nullable type annotation.

While we can't align on a single @Nullable annotation yet, we can at
least replace this one by JSR305's @Nonnull(MAYBE) as it fulfils all
requirements, including full Kotlin compatiblity. To avoid the
cumbersome name, we can redefine it as our own @NullableType
annotation. (We can't use @Nullable to avoid name clashes with the main
@Nullable annotation from AndroidX)

Issue: google/ExoPlayer#6792
PiperOrigin-RevId: 540497469
2023-06-19 16:08:20 +01:00
bachinger
5afe7552fe Document how to use a custom receiver app with the cast demo
#minor-release
Issue: androidx/media#452
PiperOrigin-RevId: 539915277
2023-06-14 20:30:32 +01:00
bachinger
c2f78db87e Clean up HLS sample for cast demo
Issue: androidx/media#452
#minor-release
PiperOrigin-RevId: 539613535
2023-06-12 14:11:36 +00:00
Tofunmi Adigun-Hameed
9aa519f1ee Merge pull request #371 from tatsuyafujisaki:simplify-loadJSONFromAsset
PiperOrigin-RevId: 538423581
2023-06-08 12:34:08 +00:00
Tofunmi Adigun-Hameed
886717e3fe Merge pull request #439 from kaidokert:pick_workaround
PiperOrigin-RevId: 538209925
2023-06-06 18:15:04 +00:00
Googler
7956c80f73 Rollback of 2a6f893fba
*** Original commit ***

BEGIN_PUBLIC
Set video size to 0/0 when video render is disabled

In terms of MCVR with a `VideoRendererEventListener`, the video size is set to
0/0 right after `onVideoDisabled()` is called and is set to the actual size as
soon as the video size is known after 'onVideoEnabled()`.

For ExoPlayer and in terms of the `Player` interface, `Player.getVideoSize()`
returns a video size of 0/0 when `Player.getCurrentTracks()` does not support
`C.TRACK_TYPE_VIDEO`. This is ensured by the masking behavior

***

PiperOrigin-RevId: 537938947
2023-06-06 18:06:46 +00:00
Tatsuya Fujisaki
4c54a12af2 Simplify loadJSONFromAsset() 2023-06-06 16:12:01 +00:00
Kaido Kert
1d20aa3c8d Add PICK intent for launching with exolist.json
This works around the issue described in #438
2023-06-06 16:33:41 +01:00
christosts
757247e2ae Release MIDI decoder module in open-source
PiperOrigin-RevId: 537034577
2023-06-02 09:18:09 +00:00
jbibik
25bf0c6738 Remove previously deprecated MediaItem.PlaybackProperties in favour of LocalConfiguration.
Deprecated field `MediaItem.playbackProperties` remains for backwards compatibility, but its type is changed from `MediaItem.PlaybackProperties` to `MediaItem.LocalConfiguration`. The private `MediaItem` constructor will now also take in a `LocalConfiguration` argument instead.

PiperOrigin-RevId: 535648420
2023-05-30 10:13:11 +00:00
Googler
86515f8683 Show the file path of the exported output video.
PiperOrigin-RevId: 535233266
2023-05-25 15:11:05 +00:00
bachinger
230921e4ab Use artwork display mode in demo app
- Use artwork display mode `fill` to improve visual apperance
- Some minor cleanup

#minor-release

PiperOrigin-RevId: 534366246
2023-05-24 15:52:15 +01:00
bachinger
46fb454b3f Add artwork display mode to PlayerView
This change deprecates `PlayerView.setUseArtwork(boolean)` and
introduces `setArtworkDisplayMode(mode)` and
`artworkDisplayMode="off|fit|fill"` instead.

- off: no artwork is displayed (like deprecated useArtwork=false)
- fit: letterbox like media (like deprecated useArtwork=true)
- fill: scales the artwork to fill the entire width/weight of the player view

#minor-release

PiperOrigin-RevId: 534167226
2023-05-24 15:47:03 +01:00
bachinger
96a4ae7e40 Minor session demo app improvements
Basically this change removes a bug that makes video playback stuck when
a video is playing and the user taps the UMO notification to get to
the player activity.

- Use `launchMode="singleTop"` for `PlayerActivity`
- Change session activity to a back stacked activity on service `onDestroy`.

Using a back stacked activity `onDestroy()` will be useful once this demo
app implements playback resumption.

The rest of the changes are aesthetic:

- clean up and optimize screen space usage in UI of `PlayerActivity`
- changed some colors, paddings and spacings
- adds a default artwork for the `PlayerView`

PiperOrigin-RevId: 534152052
2023-05-24 15:45:54 +01:00
huangdarwin
a6897aedaa Effect: Add GlTextureInfo release() and accessor methods.
This allows us to disallow access after release.

PiperOrigin-RevId: 534046475
2023-05-24 15:42:47 +01:00
bachinger
2a6f893fba Set video size to 0/0 when video render is disabled
In terms of MCVR with a `VideoRendererEventListener`, the video size is set to
0/0 right after `onVideoDisabled()` is called and is set to the actual size as
soon as the video size is known after 'onVideoEnabled()`.

For ExoPlayer and in terms of the `Player` interface, `Player.getVideoSize()`
returns a video size of 0/0 when `Player.getCurrentTracks()` does not support
`C.TRACK_TYPE_VIDEO`. This is ensured by the masking behavior of
`ExoPlayerImpl` that sets an empty track selection result when the playing
period changes due to a seek or timeline removal.

When transitioning playback from a video media item to the next, or when
seeking within the same video media item, the renderer is not disabled.

#minor-release

PiperOrigin-RevId: 533479600
2023-05-24 15:28:20 +01:00
ibaker
b3db85133a Add android.namespace to all build.gradle files
This is a pre-requisite for the Android Studio upgrade assistant to
upgrade from AGP 7.2.2 to 8.0.1, otherwise it fails and complains
this is missing.

Issue: androidx/media#409
PiperOrigin-RevId: 533463246
2023-05-19 17:19:15 +01:00
bachinger
dab1353aad Enable live DASH stream for IMA DAI
This change enables the IMA extension to play live DASH streams
with DAI support. Samples streams can be found and played in the
main demo app.

Issue: google/ExoPlayer#10912
#minor-release
PiperOrigin-RevId: 532407708
2023-05-17 08:38:06 +01:00
tonihei
804b57ea7b Add LeakCanary to session demo app debug builds
This helps to detect accidental service/activity leaks.

PiperOrigin-RevId: 529391523
2023-05-05 16:41:33 +00:00
ibaker
0f398d511d Temporarily suppress missing permission lint in session demo
#minor-release

PiperOrigin-RevId: 529370535
2023-05-04 13:05:49 +00:00