1022 Commits

Author SHA1 Message Date
jbibik
d9deda7b6e [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
(cherry picked from commit addf01b9a84bcea945107b3b2993540ec59fbb54)
2025-03-17 13:56:51 +00:00
simakova
3083a48ecb Add missing links to the effect demo README
PiperOrigin-RevId: 731305090
(cherry picked from commit 5417279982729b8bf5107c48a3cca0904b0c6300)
2025-03-03 16:27:27 +00:00
dancho
521c385d4b Add experimentalSetCodecsToParseWithinGopSampleDependencies to HLS
HLS extractors were missing
experimentalSetCodecsToParseWithinGopSampleDependencies prior to this patch.

PiperOrigin-RevId: 730878460
(cherry picked from commit da402cfd64ef3ae60607491730f01138177a077b)
2025-03-03 16:26:31 +00:00
Copybara-Service
a578d43324 Merge pull request #2115 from MGaetan89:use_objects_equals
PiperOrigin-RevId: 730860597
(cherry picked from commit cc44de8757501cab7e4bb70fd0b090c6dc9799e1)
2025-03-03 16:26:31 +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
shahddaghash
f6116a121a Add functionality for Choose local file button
Added the functionality for `Choose local file` button to be able to go and select a local file from the device. The file was then displayed by using ExoPlayer inside PlayerView.

PiperOrigin-RevId: 693756565
2024-11-06 09:36:08 -08:00
shahddaghash
7b9cfd1964 Add basic UI to effect demo app
Added a basic UI to the effect demo app, including a PlayerView, buttons to choose preset input and choose local file, and a button to apply effects. The buttons are currently not implemented, and the app will show a snackbar message when they are clicked.

PiperOrigin-RevId: 693751272
2024-11-06 09:18:44 -08:00
jbibik
0270267e08 Add ShuffleButtonState and RepeatButtonState to ui-compose
* Provide a helper Composable for remembering the state instance and launching the listening coroutine that observes the changes in the Player
* Add an example to demo-compose of using Shuffle- and Repeat- ButtonStates inside a Shuffle- and RepeatButton Composable.
* Reformat the MainActivity usage of `Shuffle` and `Repeat` buttons to form extra Player Controls and combine Prev/Play-Pause/Next with Shuffle/Repeat (Minimal controls + Extra controls = `PlayerControls`)

PiperOrigin-RevId: 692939825
2024-11-04 06:12:57 -08:00
shahddaghash
a8ed6494c3 Create an empty module for Effect demo
The new demo module aims to showcase different `Effect` capabilities.

PiperOrigin-RevId: 692912895
2024-11-04 04:12:55 -08:00
jbibik
1b302e879a Add PreviousButtonState and NextButtonState to ui-compose
* Provide a helper Composable for remembering the state instance and launching the listening coroutine that observes the changes in the Player
* Add an example to demo-compose of using Previous- and Next- ButtonStates inside a Previous- and NextButton Composable.
* Reformat the MainActivity usage of `Previous`, `PlayPause`, `Next` buttons to form Minimal Player Controls

PiperOrigin-RevId: 691943147
2024-10-31 14:52:38 -07:00
jbibik
676a3872a5 Add PlayPauseButtonState to ui-compose
Provide a helper Composable for remembering the state instance and launching the listening coroutine that observes the changes in the Player

Add an example to demo-compose of using PlayPauseButtonState inside a PlayPauseButton Composable.

The smart State object has been deemed a preferred solution over collecting Flows due to queuing/timing/buffering limitations. Instead, it uses the new `Player.listen` suspending extension function to catch the relevant events.

PiperOrigin-RevId: 691879975
2024-10-31 11:42:14 -07:00
tonihei
0fdc930444 Use media button preferences in session demo app
PiperOrigin-RevId: 689738802
2024-10-25 04:34:21 -07:00
samrobinson
45317394da Implement constant power matrices for channel mixing to mono & stereo.
Calculations are derived from the android platform channel mixing.

PiperOrigin-RevId: 689427658
2024-10-24 10:23:07 -07:00
Rohit Kumar Singh
af1b5b5102 Merge Issue: androidx/media#1826: add extension for MPEG-H decoding
Imported from GitHub PR https://github.com/androidx/media/pull/1826

Merge 6b59a1602b022ebc44411ae3440e274c51c223a7 into b5615d5e919b297def6450b45320a3165c34548c

COPYBARA_INTEGRATE_REVIEW=https://github.com/androidx/media/pull/1826 from androidx:mpegh_extension 6b59a1602b022ebc44411ae3440e274c51c223a7
PiperOrigin-RevId: 689417378
2024-10-24 09:53:45 -07:00
ibaker
b36de302f7 Remove some un-needed proguard-rules.txt symlinks
PiperOrigin-RevId: 689344803
2024-10-24 05:43:59 -07:00
jbibik
7da71f792b Move PlayerSurface from demo-compose to media3-ui-compose
The new `media3-ui-compose` module does not have any Material library dependencies, but will rely on androidx.compose + foundation/runtime/ui and other non-theming/opinionated libraries. Surface handling is one such usecase.

PiperOrigin-RevId: 689004504
2024-10-23 10:00:07 -07:00