1033 Commits

Author SHA1 Message Date
tonihei
a62af0387b Add playback resumption support to session demo app
The main part of adding resumption support is storing the
last media id and position whenever the mediaItem or
isPlaying state changes.

PiperOrigin-RevId: 752783723
2025-04-29 10:13:19 -07:00
ibaker
ae7d7dc7e8 Enable scrubbing for local files in the demo app
Scrubbing mode doesn't really work for assets loaded over the network.

This also assumes `asset://`, `data://` and `android.resource://` URIs
are 'local' but not `content://` - because these can be loaded by any
arbitrary `ContentResolver` which may do higher latency/lower bandwidth
remote loading.

PiperOrigin-RevId: 751389438
2025-04-25 06:19:16 -07:00
jbibik
f1afa17bf6 [demo-compose] Even out the weight of Prev/Play/Next buttons
Despite the size being specified as 80 dp, it's important that all the buttons are exactly 1/3 of the Row, even if it means ignoring the size.

PiperOrigin-RevId: 751343084
2025-04-25 03:09:39 -07:00
Gaëtan Muller
9b2e1cfca0 Deprecate Util.SDK_INT in favor of Build.VERSION.SDK_INT
`Util.SDK_INT` was introduced to be able to simulate any SDK version during tests.
This is possible by using Robolectric's `@Config(sdk)` annotation.
All usages of `Util.SDK_INT` have been replaced by `Build.VERSION.SDK_INT`.

This is a similar change to what was done in #2107.
2025-04-17 15:55:23 +01:00
simakova
4e8de288a5 Fix a crash in effect demo when parsing floats
Change a broken link to a remote video

PiperOrigin-RevId: 747925636
2025-04-15 10:19:57 -07:00
sheenachhabra
72bb474604 Add experimental prefix to setForce{Audio,Video}Track APIs
These APIs are likely to change/removed in near future.

PiperOrigin-RevId: 743899703
2025-04-04 04:57:56 -07:00
sheenachhabra
c858abda5d Remove usage of Composition.Builder#experimentalSetForceAudioTrack
This CL removes all usages within media3.

PiperOrigin-RevId: 741469343
2025-03-28 03:51:27 -07:00
Googler
ae563dbab0 Update Lanczos Effect to support different orientations
PiperOrigin-RevId: 739884019
2025-03-24 04:08:04 -07:00
Googler
0c78bae111 Add API to set resolution that respects orientation
This method allows a single Presentation Effect to resize portrait and landscape videos to a fixed resolution, while maintaining their orientations.

PiperOrigin-RevId: 737652909
2025-03-17 09:58:56 -07:00
kimvde
ce7bf8f76c Composition demo: use isLooping for background audio
By using this setter, the duration of the background audio doesn't need
to be computed anymore. It will also repeat the audio track if the video
track is longer.

PiperOrigin-RevId: 737621668
2025-03-17 08:22:32 -07:00
tianyifeng
4ab7ddea93 Add tracksInfoAvailable parameter in DownloadHelper.Callback.onPrepared
PiperOrigin-RevId: 733311800
2025-03-04 06:53:11 -08:00
jbibik
addf01b9a8 [ui-compose] Add PlaybackSpeedState to control playbackParameters.speed
A state holder that handles interaction with a UI component that toggles through a range of playback speeds.

[demo-compose] Use PlaybackSpeedState to create PlaybackSpeedTextButton

Add the button to the bottom extra controls.

PiperOrigin-RevId: 731449526
2025-02-26 14:09:12 -08:00
simakova
5417279982 Add missing links to the effect demo README
PiperOrigin-RevId: 731305090
2025-02-26 07:12:40 -08:00
dancho
da402cfd64 Add experimentalSetCodecsToParseWithinGopSampleDependencies to HLS
HLS extractors were missing
experimentalSetCodecsToParseWithinGopSampleDependencies prior to this patch.

PiperOrigin-RevId: 730878460
2025-02-25 07:31:30 -08:00
Gaëtan Muller
a17a3ebc67 Replace usages of Util.areEqual() with Objects.equals() 2025-02-21 11:01:09 +00:00
tonihei
dfd2b75720 Stablize command button icons
These are the preferred replacement for custom icon res ids.

PiperOrigin-RevId: 726821168
2025-02-14 01:24:18 -08:00
andrewlewis
9e22f03718 Add support for screen recording to the Transformer demo
Screen recording continues even if the transformer activity is backgrounded,
to support recording other apps.

PiperOrigin-RevId: 726454538
2025-02-13 06:16:54 -08:00
jbibik
d022b570f2 Upgrade Kotlin to 2.0.20
This upgrade allows us to use https://developer.android.com/develop/ui/compose/compiler as specified in https://developer.android.com/jetpack/androidx/releases/compose-kotlin#pre-release_kotlin_compatibility

kotlinOptions is considered deprecated in preference of kotlin.compilerOptions (https://kotlinlang.org/docs/gradle-compiler-options.html#how-to-define-options)

PiperOrigin-RevId: 725266131
2025-02-10 10:32:47 -08:00
Googler
4ed9abd05b Rollback of 0fb4e3ba11
PiperOrigin-RevId: 722585306
2025-02-03 03:18:59 -08:00
shahddaghash
5f4c30c431 Add color changing for Text overlay effect
This includes adding a colors dropdown menu for the text color.

PiperOrigin-RevId: 721830591
2025-01-31 10:59:16 -08:00
shahddaghash
9c0a9c19b7 Add Custom Text Overlay to Effect Demo
It includes entering a custom text and setting the alpha scale. When the effect is applied, it shows the text in the center of the screen. A following change will include changing the color of the text.

PiperOrigin-RevId: 721828892
2025-01-31 10:54:50 -08:00
Googler
0fb4e3ba11 Add DebugViewEffect
Also updated DefaultVideoFrameProcessor to create GlShaderPrograms with the working ColorInfo rather than the output ColorInfo.

PiperOrigin-RevId: 721748002
2025-01-31 06:13:57 -08:00
tonihei
ddcf455d03 Convert context dependent TrackSelectionParameters to boolean
This avoids that these settings have to be resolved inline,
potentially blocking the main thread. They can be resolved at
the time of track selection on a background thread instead.

As a side effect, we can also remove the context parameter from
the Builder. Having the Context in the Builder is also a bad sign
in the first place because it implies the potentially blocking
calls can happen.

PiperOrigin-RevId: 720523139
2025-01-28 04:26:15 -08:00
Copybara-Service
c1242ffef1 Merge pull request #1235 from DolbyLaboratories:dlb/dovi-transformer/dev
PiperOrigin-RevId: 718856455
2025-01-23 07:26:21 -08:00
sheenachhabra
4ac4f7e2e0 Split InAppMuxer into InApp Mp4Muxer and FragmentedMp4Muxer
This is pre work required to remove `Muxer.java` interface
from the muxer module.
`Mp4Muxer` and `FragmentedMp4Muxer` will no longer implement
the `Muxer` interface.

PiperOrigin-RevId: 716669531
2025-01-17 08:01:28 -08:00
simakova
22142e0db3 Add keepScreenOn flag in Composition demo
PiperOrigin-RevId: 716139653
2025-01-16 01:57:53 -08:00
jbibik
52387bb975 [ui-compose] Rename showSurface to coverSurface in PresentationState
This renaming helps prevent the consumer from including `PlayerSurface` in a Compose tree based on `state.showSurface`. This field intuitively felt like the default would be not to show the surface (correct), but had an unintended consequence of not initialising `AndroidExternal(Embedded)Surface` (since the PlayerSurface Composable would be omitted).

To avoid this confusion, the `PresentationState` should communicate to the consumer when the Surface is not ready and hence should be covered with some overlay (shutter) to prevent poor UX from observing Surface resizing/freezing/flickering.

PiperOrigin-RevId: 714951607
2025-01-13 06:59:44 -08:00
jbibik
28027c64fd [ui-compose] Add aspect ratio to PresentationState
It captures the information needed for the UI logic related to rendering of the video track (and later images) to the surface.

The video size will be correct only after the Player decoded the video onto the surface and can't be reliably extracted from MediaItem's metadata. The information about the video's true aspect ratio helps inform the UI elements (such as PlayerSurface Composable) how to customize the Modifiers.

Use this state in demo-compose to show off functionality of changing `PlayerSurface`'s aspectRatio

PiperOrigin-RevId: 714104260
2025-01-10 10:50:53 -08:00
jbibik
709d3fd35e [demo-compose] Refactor modifier with better Kotlin syntax
PiperOrigin-RevId: 713476190
2025-01-09 00:22:17 -08:00
shahddaghash
6f187a3859 Add confetti overlay to Effect demo
Added the first overlay effect to the Effect demo. It includes an emitter of confetti that drops from the center of the frame.

PiperOrigin-RevId: 712940163
2025-01-07 09:33:36 -08:00
jbibik
2dc6af1fae [ui-compose] Add PresentationState for first-frame info
It captures some information needed for the UI logic related to rendering of the video track (and later images) to the surface.

Supporting `EVENT_RENDERED_FIRST_FRAME` helps improve the UX by covering the surface with an overlay (scrim/shutter) until the first frame is ready. This helps avoid sudden flickering during MediaItem transitions.

PiperOrigin-RevId: 712889568
2025-01-07 06:34:02 -08:00
andrewlewis
5a87aab2f7 Use Util to request permissions in Transformer demo
This avoids requesting storage permissions for URLs that don't require it.

Also tidy clean-up into `cleanUpExport`, rename `releasePlayer` to
`releasePlayers` as there are players for both input and output, and reduce
live range of `uri` variable.

PiperOrigin-RevId: 712857115
2025-01-07 04:13:36 -08:00
jbibik
ff80ab220f [demo-compose] Add Activity lifecycle methods
Take care of releasing the player and re-initialising when returning to the app to prevent memory leaks.

Instead of overriding onStart, onPause, onResume, onStop - use Lifecycle*Effects for a more native compose cleanup. Requires a higher version of the lifecycle library.

PiperOrigin-RevId: 712542884
2025-01-06 08:49:41 -08:00
jbibik
d8333b37cf Upgrade compose bom to 2024.12.01
The latest version of `androidx.compose.foundation:foundation` fixed an issue where `AndroidEmbeddedExternalSurface` would not reset properly. This in turn prevented PlayerSurface Composable with type `SURFACE_TYPE_TEXTURE_VIEW` from being redrawn after returning to a stopped activity.

PiperOrigin-RevId: 712501647
2025-01-06 06:05:30 -08:00
jbibik
d01d10ce0e [demo-compose] Refactor MediaPlayerScreen() into ComposeDemoApp()
PiperOrigin-RevId: 712495147
2025-01-06 05:33:32 -08:00
jbibik
afd601f670 Refactor non-ripple Modifier into a separate file
Modifiers.kt will be a place for other extensions on Modifier class

PiperOrigin-RevId: 709416429
2024-12-24 15:27:21 -08:00
jbibik
6da58758a8 Add vertical videos to demo-compose
Useful for future testing of aspect ratio functionality.

PiperOrigin-RevId: 709354104
2024-12-24 08:47:42 -08:00
Googler
c12b1768a6 Add sample rate fallback to DefaultEncoderFactory
After this change if a sample rate is requested that is not supported by the available encoders and enableFallback is true, DefaultEncoderFactory will fall back to the encoder with the closest matching sample rate.

In the case when an encoding profile is included in requestedAudioEncoderSettings, an encoder matching that profile will continue to be preferenced.

PiperOrigin-RevId: 708295869
2024-12-20 05:50:25 -08:00
shahddaghash
acc41cb5f7 Add contrast effect to effect demo
Added a contrast effect and the connection needed to apply the video effects to ExoPlayer.

The effect can be applied to the video by checking the "Contrast" card, and use the slider to change the contrast value. The effects are applied when `Apply effects` button is clicked.

PiperOrigin-RevId: 707092041
2024-12-17 07:33:52 -08:00
bachinger
12566a50d5 Reorder IMA samples for easier QA testing
PiperOrigin-RevId: 707014618
2024-12-17 02:33:21 -08:00
jbibik
e0496ff88d [demo-compose] Initialize the Player outside of Compose
PiperOrigin-RevId: 705533932
2024-12-12 09:39:50 -08:00
shahddaghash
dc21f3add2 Add preset input picker functionality
Added functionality to `Choose preset input` button. The picker allows the user to select a preset input from a list of loaded preset playlists. The selected preset input is then used to populate the ExoPlayer with the corresponding media items.

PiperOrigin-RevId: 704626144
2024-12-10 02:51:06 -08:00
jbibik
038d7c8cb9 Remove kotlin-android plugin from main demo
This fixes the problem with `compileDebugKotlin` gradle task and `Unknown Kotlin JVM target: 21`.

PiperOrigin-RevId: 703427496
2024-12-06 02:46:21 -08:00
shahddaghash
b6724e2115 Load preset input from JSON file in EffectActivity
The JSON file contains a list of playlists, each with a name and a list of media items. The EffectActivity loads the JSON file and creates a list of PlaylistHolder objects, which contain the playlist name and the list of media items.

PiperOrigin-RevId: 703069411
2024-12-05 04:46:47 -08:00
Yuri Schimke
10ca39a779 Specify androidx.activity:activity-compose as 1.9.0
The Compose BOM doesn't provide this.
https://developer.android.com/develop/ui/compose/bom/bom-mapping
2024-12-03 14:39:08 +00:00
claincly
675c1d898a Move interface locations
PiperOrigin-RevId: 702096389
2024-12-02 15:03:37 -08:00
claincly
e357629400 Make back button pause player instead of quitting app
PiperOrigin-RevId: 700282443
2024-11-26 03:33:45 -08:00
kimvde
6a3def3ccb Turn off repeat mode on Composition demo app
This is to make debugging easier.

PiperOrigin-RevId: 700265039
2024-11-26 02:14:04 -08:00
dancho
c0fb4b7aff Composition demo app: show extended brightness
Request COLOR_MODE_HDR and show HDR content
as brighter-than-SDR.

PiperOrigin-RevId: 699887643
2024-11-25 01:22:54 -08:00
tianyifeng
c3d4722197 Resolve the memory leaks in demo short-form app
Issue: androidx/media#1839
#cherrypick
PiperOrigin-RevId: 696080063
2024-11-13 04:42:47 -08:00