738 Commits

Author SHA1 Message Date
ibaker
7a1d7bf5ea Temporarily suppress missing permission lint in session demo
#minor-release

PiperOrigin-RevId: 529370535
(cherry picked from commit 0f398d511dda9e89db64c841329a3938ea38bb62)
2023-05-15 16:32:38 +01:00
ibaker
375cdb2e22 Use a for-each loop instead of forEach in PlaybackService.kt
The current code flags a lint error:

```
Error: Call requires API level 24 (current min is 16): java.lang.Iterable#forEach [NewApi]
```

I think this is a bit confusing because this is calling the Java
[`Iterable.forEach`](https://developer.android.com/reference/java/lang/Iterable#forEach(java.util.function.Consumer%3C?%20super%20T%3E))
method which was added in Java 8 (and therefore is only available on
API 24 and up), but there is **also** a Kotlin
[`List.forEach`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/for-each.html)
method which is available in all versions of Kotlin (and therefore all
Android versions). Since this is a Kotlin file, at first glance you
would assume this is the Kotlin method - but it's not.

This also doesn't seem to be flagged by Android Studio, but is caught
by Gradle lint on the command line.

#minor-release

PiperOrigin-RevId: 529112610
(cherry picked from commit 09b474a51936c9c83df32dfcaf816e37a72552ce)
2023-05-15 16:32:38 +01:00
ibaker
b0b34def3d Fix demo app UnsafeOptInUsageError lint errors
This change:
* Adds missing `@OptIn` annotation to demo app's `ErrorMessageProvider`
* Switches from `Util.SDK_INT` to `Build.VERSION.SDK_INT` in
  `SampleChooserActivity` (`PlayerActivity` is already using this).

This code hasn't changed recently, and it doesn't fail on the `release`
branch, but it failed when I checked the `main` branch just now - so I
assume lint has updated to detect more cases where unstable APIs are
being used without opt-in. I suspect the difference is due to different
Android Gradle Plugin versions between the branches.

#minor-release

PiperOrigin-RevId: 529111669
(cherry picked from commit ebcdd983e2c5a9819d8a66873351bccbf93124c6)
2023-05-15 16:32:38 +01:00
bachinger
3406334ee8 Allow MediaLibraryService to reject the resumption notification
To reliably reject the System UI playback resumption notification on
all API levels (specifically API 30), the backward compatibility layer
needs to return `null` for the library root.

This is not possible in the Media3 implementation. This change allows
an app to return a `LibraryResult.ofError(RESULT_ERROR_NOT_SUPPORTED)`
that then is translated to return null by the backwards compatibility
layer.

Issue: androidx/media#355
Issue: androidx/media#167
Issue: androidx/media#27

See https://developer.android.com/guide/topics/media/media-controls#mediabrowserservice_implementation

PiperOrigin-RevId: 527276529
(cherry picked from commit 7938978b5165a9cbb63a6ee1fe5209934e996c6e)
2023-05-15 16:27:46 +01:00
tonihei
58cf3a7ba2 Remove unnecessary Activity method overrides in session demo app
The PlayerView methods are documented to only be needed for sphrerical
playbacks, which we are not using in the session demo app.

PiperOrigin-RevId: 525986709
(cherry picked from commit 2de89ca2ce4c06bcbf9cb80dcc903f2cdd3ff733)
2023-05-15 16:11:02 +01:00
ibaker
d5a81c5c41 Use @link instead of @value
Dackka doesn't support `@value`

PiperOrigin-RevId: 524309695
(cherry picked from commit b834e49f9ff1b3777e5b69c609b9eed83e9e6a5f)
2023-04-18 15:18:39 +01:00
rohks
1076756d1c Enable multidex for demo-gl app
#minor-release

PiperOrigin-RevId: 523708424
(cherry picked from commit 81fd9d2867602551602d3bde9a95e8c268593d18)
2023-04-18 15:16:49 +01:00
tonihei
0690c9ba67 Replace deprecated onBackPressed call
PiperOrigin-RevId: 523361561
(cherry picked from commit be85684dc963faf2695f1111cf6f82f257fa6e9e)
2023-04-18 14:59:19 +01:00
tonihei
8aec88b2b4 Add missing initial update to the subtitle button in the session demo
The button gets only updated after an onTracksChanged callback but
isn't set to the initial state similar to other changes triggered
by callbacks (e.g. updateRepeatSwitchUI)

PiperOrigin-RevId: 522274800
(cherry picked from commit 14ba173dfea5f077d2371b5f5d01313551ecdf60)
2023-04-18 14:59:19 +01:00
Googler
3daaad7acd ...Suppress MissingSuperCall warnings on onBackPressed()...
PiperOrigin-RevId: 520709134
(cherry picked from commit 5af28a980d657cf1038be34f1d7939104e5e721b)
2023-04-18 14:56:45 +01:00
tonihei
d07fcc3457 Remove remaining references to exoplayer.dev
PiperOrigin-RevId: 520314781
(cherry picked from commit 6952771e2f0637e91e27ed8851dc5b2a5a199afe)
2023-04-18 14:56:45 +01:00
Andrew Lewis
e78332f9f4
Shorten labels to fix transformer demo UI 2023-03-14 10:17:10 +00:00
bachinger
bfc4ed4dd4 Inline method in PlayerService that is used from on call site only
#cleanup
#minor-release

PiperOrigin-RevId: 505146915
(cherry picked from commit d7ef1ab5bd5a4508c0913011f5990bb03a57585a)
2023-02-02 13:22:38 +00:00
tianyifeng
79fd80f8b0 Post notification for session app when FgS starting exception is caught
PiperOrigin-RevId: 502407886
(cherry picked from commit 6ce3421ca750109acfea35029260dc3f169a1a40)
2023-01-25 18:18:42 +00:00
bachinger
1b8608f179 Request notification permission in demo app for API 33+
Starting with API 33 the POST_NOTIFICATION permission needs to be
requested at runtime or the notification is not shown.

Note that with an app with targetSdkVersion < 33
but on a device with API 33 the notification permission is automatically
requested when the app starts for the first time. If the user does not
grant the permission, requesting the permission at runtime result in
an empty array of grant results.

Issue: google/ExoPlayer#10884
PiperOrigin-RevId: 501320632
(cherry picked from commit 6484c14acd4197d335cab0b5f2ab9d3eba8c2b39)
2023-01-25 18:18:41 +00:00
ibaker
70156dce4f Enable RTL support in the demo app
We might as well keep this enabled by default, rather than having to
manually toggle it on to investigate RTL issues like Issue: androidx/media#227.

PiperOrigin-RevId: 497159744
(cherry picked from commit 69583d0ac1fa1ab1a1e250774fc1414550625967)
2023-01-25 18:17:16 +00:00
tonihei
71a1254514 Replace MediaMetadata folderType by isBrowsable
The folder type has a mix of information about the item. It shows
whether the item is browsable (type != FOLDER_TYPE_NONE) and
which Bluetooth folder type to set for legacy session information.

It's a lot clearer to split this into a boolean isBrowsable and
use the existing mediaType to map back to the bluetooth folder type
where required.

folderType is not marked as deprecated yet as this would be an API
change, which will be done later.

PiperOrigin-RevId: 493544589
(cherry picked from commit ae8000aecaee725dea51a6ded06125884a5b8112)
2023-01-25 18:17:11 +00:00
michaelkatz
c4f1c047ca Added cancellation check for MediaBrowserFuture in demo session app
When app is deployed with device's screen being off, MainActivity's onStart is called swiftly by its onStop. The onStop method cancels the browserFuture task which in turn "completes" the task. Upon task "completion", pushRoot() runs and then throws error as it calls get() a cancelled task.

PiperOrigin-RevId: 492416445
(cherry picked from commit 64603cba8db9fbd9615e19701464c4d0734a86dc)
2023-01-25 17:50:39 +00:00
bachinger
868e86cd3f Stop service when app is terminated while the player is paused
If the service ever has been started but is not in the foreground, the
service would be terminated without calling onDestroy(). This is because
when onStartCommand returns START_STICKY [1], the app takes the
responsibility to stop the service.

Note that this change interrupts the user journey when paused, because the
notification is removed. Apps can implement playback resumption [2] to give
the user an option to resume playback after the service has been terminated.

[1] https://developer.android.com/reference/android/app/Service#START_STICKY
[2] https://developer.android.com/guide/topics/media/media-controls#supporting_playback_resumption

Issue: androidx/media#175
#minor-release
PiperOrigin-RevId: 492192690
(cherry picked from commit 6a5ac19140253e7e78ea65745914b0746e527058)
2023-01-25 17:50:39 +00:00
tianyifeng
bbf7324494 Update targetSdkVersion of demo session app to appTargetSdkVersion
PiperOrigin-RevId: 488884403
(cherry picked from commit cfe36af8478e78dd6e334298bcee425c61a9ba2a)
2023-01-25 17:37:31 +00:00
ibaker
e4ff4a3b04 Reformat demo build.gradle file
PiperOrigin-RevId: 488376715
(cherry picked from commit adc993dc5713b92f40ada6683bfa0a532bfb75ed)
2022-11-17 10:04:35 +00:00
ibaker
dafbbf25e6 Reformat demo build.gradle file
PiperOrigin-RevId: 487539107
(cherry picked from commit 62d6c303c1a9fd56e27ffc7ad7cc39f92f957bd7)
2022-11-17 10:04:35 +00:00
christosts
afb0f12fa4 Set targetSdkVersion of main demo app to 29
#minor-release

PiperOrigin-RevId: 487479366
(cherry picked from commit 40c6c431972cf5e378d46fef0d68fabce7e26caf)
2022-11-10 10:33:41 +00:00
huangdarwin
45f6c24bf2 HDR: Implement ForceInterpretHdrVideoAsSdr
Also, document that we tone map when no HDR features are explicitly set

PiperOrigin-RevId: 487310971
(cherry picked from commit 2ff5dab0039c44d767dc831fec92724254e5e0aa)
2022-11-09 20:05:24 +00:00
tonihei
13a4089eaf Set matching folder type in Session demo app.
The folder type is useful metadata to understand programmatically
what criterion was used to create the folder.

PiperOrigin-RevId: 486653317
(cherry picked from commit ab9f0608cd3d779b71623e4fa8ff2df149affb64)
2022-11-07 15:16:16 +00:00
bachinger
1607e3daf5 Make adding ad live breaks more robust
This change makes adding ad events in live streams more robust by allowing ad
groups to grow in number of ads if more ad events are received than initially
announced by the SDK.

With the IMA prefetch feature, an AdPod can grow in size in certain conditions
like from initially 2 ads to 4 ads being part of the ad group. With this change,
if an additional ad event arrives while the ad group is still being played,
the ad group is expanded. If the event arrives late and the ad group is already
completed, a new group is created for the remaining ads.

This also covers the case where we join the live stream while an ad is being
played and we missed at least one LOADED event from the SDK. Ads of the group
before the first LOADED event are ignored in such a case.

PiperOrigin-RevId: 484214760
(cherry picked from commit 64e9e888230be1874720ced001e8112fc3ee407b)
2022-10-27 11:10:10 +00:00
tofunmi
36225d0ff9 Mute input video player in transformer demo
PiperOrigin-RevId: 483969411
(cherry picked from commit f1ca4f41b1fb4d0c16a53918f0aceb960a3f5134)
2022-10-26 15:01:30 +00:00
Googler
82e51d5669 Fix blank toast in Transformer Demo
PiperOrigin-RevId: 480847967
(cherry picked from commit 7e8f0f0918bdcaa855160151861f23c9b1a90392)
2022-10-13 10:32:32 +00:00
huangdarwin
cc67241062 Demo: Shorten trim range from 60 seconds to 10 seconds.
Most demo videos aren't very long, and the default demo video is only 10 seconds.

Shorten the maximum trim duration to 10 seconds, to demonstrate transformer functionality more easily, and allow this to be used more easily when trimming short sections of a longer video (ex. to make test clips)

PiperOrigin-RevId: 480602037
(cherry picked from commit f35bda3524408d8bf560c080bd6a80698c7c08e1)
2022-10-12 12:58:12 +00:00
huangdarwin
28763e7d21 Demo: Hide player controls by default.
Player controls are somewhat distracting when showing the difference between the
input and output video, as they obscure and darken the video players.

PiperOrigin-RevId: 480597804
(cherry picked from commit 51edb329a124e5af302e1ebbd3527300619ac86a)
2022-10-12 12:26:07 +00:00
huangdarwin
8f3070834f Demo: Read long values from trim slider.
Before, slider values were read as `floor()`'ed `longValue()`s, so that trimming to
intervals less than one second would be interpreted as a request for a zero-
duration trim.

Also, rename `radiusRange` references here to `trimRange`, since this is not a
radius range.

PiperOrigin-RevId: 480401556
(cherry picked from commit fb5cd18dcd8b8e2a6baa308d6907f2e02751474e)
2022-10-11 17:57:01 +00:00
Googler
c40da71a3a Add local file picker to ConfigurationActivity
PiperOrigin-RevId: 480349627
(cherry picked from commit b515e0bd7fd382a7b3485e83ad7c65df4eff1a85)
2022-10-11 14:21:12 +00:00
tonihei
d35f67a8a6 Set new playlist and start index with one command
PlayableFolderActivity currently uses two seperate commands
to set the playlist and then seek to the requested item.

This is slightly inefficient and also causes analytics
listeners to believe the first item in the playlist was
briefly active.

#minor-release

Issue: androidx/media#180
PiperOrigin-RevId: 480031682
(cherry picked from commit 5d6d069e4e946a46884a838482567ff085e88283)
2022-10-10 09:33:21 +00:00
Googler
3ff7c05044 Add button to show/hide input player in TransformerActivity
PiperOrigin-RevId: 479003655
(cherry picked from commit 50df923b258ce89c3bbebac1aa8f48e385e358d2)
2022-10-05 10:26:27 +00:00
Googler
c8917b50e6 Add second player for input video
PiperOrigin-RevId: 478510687
(cherry picked from commit 48a7f6a9240cd7c0ce8016915de630d903e5c393)
2022-10-03 15:27:33 +00:00
samrobinson
c08e4b664b Demo: Split video Effect generation out of createTransformer.
PiperOrigin-RevId: 477524540
(cherry picked from commit 1cfe18cd1f45e850df3b21ca8e63635956cf758e)
2022-09-28 19:39:09 +00:00
Googler
ff22da9011 Fix checkboxes on configuration page
PiperOrigin-RevId: 477166507
(cherry picked from commit bb811f0da50b632d68ae50ace90028e10f6bab8e)
2022-09-27 14:31:59 +00:00
huangdarwin
4c3acbf739 HDR: Update gamma comments to linear.
Comment-only change.

PiperOrigin-RevId: 476873286
(cherry picked from commit 16dca1828c30c99fef9b63b46a5fe0cd7e7f65dc)
2022-09-26 13:00:17 +00:00
leonwind
638d806a49 Add example CLUT to demo.
PiperOrigin-RevId: 476390089
(cherry picked from commit 5b3efa8ad9557419a68a1a172c1d584aeecfd433)
2022-09-23 16:28:25 +00:00
leonwind
20518cc151 Add HSL Adjustments to the demo.
PiperOrigin-RevId: 476373520
(cherry picked from commit 7626f70cef1e6a431fbe2773a3a930904a67c803)
2022-09-23 15:11:52 +00:00
leonwind
873b806389 Add RGB Adjustments to transformer demo.
PiperOrigin-RevId: 476049125
(cherry picked from commit 9ccdd22e856251e7529fb893edbaa118f4285e49)
2022-09-22 10:04:42 +00:00
leonwind
2dfca4fca8 Add sepia, grayscale, and inverted filters to the demo app.
PiperOrigin-RevId: 471782565
(cherry picked from commit 305ea20518b037566839c64bafbc9e42f3d7a8b2)
2022-09-02 13:10:29 +00:00
rohks
62ed45b505 Use ContextCompat.getMainExecutor when calling MediaBrowser methods
Replacing remaining usage of MoreExecutors.directExecutor. This allows the service to be switched to run in another process and the app still works the same as if it is running in the same process.

Issue: androidx/media#100
PiperOrigin-RevId: 471547177
(cherry picked from commit 9a6745431a285a4403e66aa4227f6fc1d118ba75)
2022-09-01 16:08:00 +00:00
rohks
b42dcd675c Switch incorrectly configured native multidex to legacy for demos
Native multidex can only be used for binaries with minSdkVersion of 21 or higher, but minSdkVersion was specified to 16.

PiperOrigin-RevId: 470004102
(cherry picked from commit d260b0c2a008c4ff9b3763f32feb87b353fc23f2)
2022-08-25 16:09:00 +00:00
leonwind
bf299da11c Delete glPrograms in Contrast and RgbMatrix.
Remove unecessary null checks.

PiperOrigin-RevId: 469999952
(cherry picked from commit a7d3752c6655d6572101b4b4c8b88c885fcf80de)
2022-08-25 15:49:13 +00:00
rohks
6b5a9e8058 Fix missing id error
PiperOrigin-RevId: 469750922
(cherry picked from commit 84577949782653a08127bdab820e56bda0b913e5)
2022-08-24 16:40:39 +00:00
huangdarwin
d91f60b6e6 HDR: Update limited range and add full range YUV to RGB color transforms.
PiperOrigin-RevId: 467910378
(cherry picked from commit d963dfbd3e478f01077e45ad84bae6d1ea666038)
2022-08-16 13:33:32 +00:00
Googler
6b4d174cde Avoid spinning in between intermediate texture processors.
This change adds a new method onReadyToAcceptInputFrame to
GlTextureProcesssor.InputListener and changes maybeQueueInputFrame
to queueInputFrame, removing the boolean return value.
This avoids the re-trying in ChainingGlTextureProcessorListener
by allowing it to only feed frames from the producing to the consuming
GlTextureProcessor when there is capacity.

MediaPipeProcessor still needs re-trying when processing isn't 1:1.

PiperOrigin-RevId: 466626369
(cherry picked from commit 97e6a86d2b1f72de9f95658f90ea40d1e1e4fac2)
2022-08-10 09:56:24 +00:00
huangdarwin
b89320521a Demo: Add legacy external storage permission for intents.
Without this permission, files in `/sdcard` or other directories cannot be read by the demo, as they're not in the transformer demo's scoped storage container.

For more information, see https://developer.android.com/training/data-storage/use-cases

Tested by uninstalling and re-installing the demo app, granting permission by
starting a transformation, and launching an intent using a local file in `/sdcard`
to start another transformation. Without this CL, this threw an error, and with
this CL it succeeded.

PiperOrigin-RevId: 466399023
(cherry picked from commit ec6ed0d55f59c9387aa09b1514bea9951a6206f8)
2022-08-09 17:28:31 +00:00
Googler
cdd47ff703 Split GlTextureProcessor.Listener into input/output/error listener.
This simplifies ChainingGlTextureProcessor as it now only connects a
consuming and a producing GlTextureProcessor rather than a previous,
current, and next GlTextureProcessor.

Also use default no-op implementations of the listeners in
SingleFrameGlTextureProcessor and MediaPipeProcessor to avoid
null-checks.

PiperOrigin-RevId: 466301642
(cherry picked from commit 7dc05edbab233dcd631a4a78ad65f1c30a1e9734)
2022-08-09 10:05:14 +00:00