801 Commits

Author SHA1 Message Date
jbibik
629ab59b5f 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
(cherry picked from commit 25bf0c6738b6bf58e153a1ddbb0cb29c40501e13)
2023-06-12 09:13:51 +00:00
Googler
d7e5c1bb0b Show the file path of the exported output video.
PiperOrigin-RevId: 535233266
(cherry picked from commit 86515f8683fe3b035aff175b5dbb7898922da716)
2023-05-26 13:34:52 +00:00
bachinger
f8ef386065 Use artwork display mode in demo app
- Use artwork display mode `fill` to improve visual apperance
- Some minor cleanup

#minor-release

PiperOrigin-RevId: 534366246
(cherry picked from commit 230921e4ab999f3f9af40688cedaf02631052a95)
2023-05-26 13:25:08 +00:00
bachinger
f372440882 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
(cherry picked from commit 46fb454b3ffc4b2ad97ceccb4dc798e1c9a4c774)
2023-05-26 13:25:08 +00:00
bachinger
5f3cb861fc 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
(cherry picked from commit 96a4ae7e40732dccd2fdded4cb8d0cc7f25f8cdd)
2023-05-26 13:25:08 +00:00
huangdarwin
9d04b11d49 Effect: Add GlTextureInfo release() and accessor methods.
This allows us to disallow access after release.

PiperOrigin-RevId: 534046475
(cherry picked from commit a6897aedaa540dd10ba3be72b4e871ef0f241fd8)
2023-05-26 13:25:08 +00:00
bachinger
b066a0912e 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
(cherry picked from commit 2a6f893fba763077cae85b0255d6bd05f0887709)
2023-05-26 13:25:07 +00:00
bachinger
1510710c46 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
(cherry picked from commit dab1353aadd4a093d29e1d418f012d42964e9d50)
2023-05-17 16:59:56 +00: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
ibaker
09b474a519 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
2023-05-03 17:30:52 +00:00
ibaker
ebcdd983e2 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
2023-05-03 17:29:41 +00:00
bachinger
7938978b51 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
2023-04-27 12:23:26 +01:00
tonihei
889f435a49 Update dependencies to latest versions
The only dependencies that are not updated are the ones that need
to be kept in sync with other system (like Android source tree) or
would require a Kotlin dependency in common or exoplayer modules.

As a side effect, some demo apps now need a Kotlin config and some
additional modules require desugaring/multidex logic. To simplify
the setup, the desugaring and multidex steps are added to the common
config.

PiperOrigin-RevId: 527243950
2023-04-26 15:49:57 +01:00
tonihei
2de89ca2ce 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
2023-04-24 11:29:46 +01:00
bachinger
c623b965c5 Use DataSourceBitmapLoader in session demo app
Issue: androidx/media#327
PiperOrigin-RevId: 525103046
2023-04-18 18:09:24 +01:00
huangdarwin
b61abefd7b Demo: Prefer UNICODE character.
PiperOrigin-RevId: 524802289
2023-04-17 17:18:01 +01:00
tonihei
f2cd34ad01 Fix formatting
PiperOrigin-RevId: 524772236
2023-04-17 17:15:13 +01:00
claincly
eadb78e52a Fix crash when there's no input player view.
This happens when the input is an image. The output will always be video so the
outputPlayer and outputVideoTextView will always present.

PiperOrigin-RevId: 524329436
2023-04-17 17:11:35 +01:00
ibaker
b834e49f9f Use @link instead of @value
Dackka doesn't support `@value`

#minor-release

PiperOrigin-RevId: 524309695
2023-04-17 17:10:49 +01:00
simakova
fab3abfd7c Fix input video duration in the result view in transformer demo
PiperOrigin-RevId: 524305085
2023-04-17 17:09:13 +01:00
claincly
b40f4792f0 Add a portrait image to the demo app.
PiperOrigin-RevId: 524282997
2023-04-17 17:07:03 +01:00
claincly
2ee84b809d Tap the video playback view to switch audio output.
PiperOrigin-RevId: 524027177
2023-04-17 17:02:27 +01:00
rohks
81fd9d2867 Enable multidex for demo-gl app
#minor-release

PiperOrigin-RevId: 523708424
2023-04-12 17:03:15 +01:00
tonihei
be85684dc9 Replace deprecated onBackPressed call
PiperOrigin-RevId: 523361561
2023-04-12 16:47:33 +01:00
tonihei
14ba173dfe 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
2023-04-11 10:29:32 +01:00
Googler
5af28a980d ...Suppress MissingSuperCall warnings on onBackPressed()...
PiperOrigin-RevId: 520709134
2023-04-05 15:35:22 +01:00
tonihei
6952771e2f Remove remaining references to exoplayer.dev
PiperOrigin-RevId: 520314781
2023-03-30 17:20:36 +00:00
tofunmi
c17e043403 Transformer Demo: Hide playback views during transformation
PiperOrigin-RevId: 518560945
2023-03-30 17:00:11 +00:00
tofunmi
8df4fd769c Log export errors that occur after export completes
PiperOrigin-RevId: 518281002
2023-03-22 10:35:05 +00:00
Googler
7c7a6298ff Fixed TableLayout in demo UI to work with small screens
PiperOrigin-RevId: 518257650
2023-03-21 14:23:29 +00:00
huangdarwin
236748070c Demo: Shorten default trim range from 10s to 1s.
Shorten the demo's default trim range from 0-10s to 0-1s, and change the
UI-supported trim range from 0-60s to 0-10s.

Most demo videos aren't very long, and the default demo is 10 seconds.

The use-case for trimming in the demo seems to be mostly for validating trimming
works, or generating test media. Test media should tend to be short in order to be
small, so shortening the trim range helps this be accomplished more effectively.

PiperOrigin-RevId: 517103583
2023-03-16 15:35:18 +00:00
tofunmi
2c852ea7bb Replace bitmap overlay uri EditText with local file picker
PiperOrigin-RevId: 515283537
2023-03-14 07:47:10 +00:00
tofunmi
68578be372 Update createStaticBitmapOverlay to take in context.
By making this method accept context, we can use DefaultDataSource.Factory in the DatasourceBitmapLoader to support a wider range on URI schemes in Bitmap Overlays. (and implement a local file picker for images for custom bitmap overlays in the demo transformer app)

PiperOrigin-RevId: 515013460
2023-03-14 07:39:43 +00:00
tofunmi
e478d81b52 Update effect to take in and use a GlObjectsProvider
PiperOrigin-RevId: 514744747
2023-03-14 07:33:25 +00:00
tofunmi
7303caffb5 Create GlObjectsProvider
To create this file TextureInfo has been moved to common and renamed to GLTextureInfo.

We'll look to expand the interface in future to cover more of the methods around GL object maintenance in future as required.

PiperOrigin-RevId: 514445397
2023-03-07 11:56:08 +00:00
tofunmi
efaf4e3f33 Remove effect/SimpleBitmapLoader & replace with DataSourceBitmapLoader
PiperOrigin-RevId: 513824487
2023-03-07 11:46:58 +00:00
kimvde
31c44c7061 Split transmux into transmuxAudio/Video
- Split the transmux setting into transmuxAudio and transmuxVideo. This
  is more flexible for apps and will also be useful for unit testing
  (particularly as we can't test video transcoding on Robolectric at the
  moment).
- Move these settings to Composition. It makes sense for these settings
  to be next to forceAudioTrack. Apps may also want to set these
  settings based on the current Composition's MediaItems.
- Add a Composition.Builder because Composition now contains a few
  optional fields.

PiperOrigin-RevId: 511708618
2023-02-27 18:26:30 +00:00
huangdarwin
84acfe7867 Effect: Rename to ScaleAndRotateTransformation
Rename ScaleToFitTransformation to ScaleAndRotateTransformation.

This better represents the operations that can be accomplished using this
effect. The name was originally named ScaleToFit* because it's not obvious how
to scale to fit using OpenGL, and this effect handled the scaling to fit in a way that no other MatrixTransformations did.

However, it's hard to discover how to rotate when skimming names of effects, so
it's probably more useful to convey that this effect rotates, than that it
scales to fit.

PiperOrigin-RevId: 510480078
2023-02-27 18:02:45 +00:00
kimvde
5806414fba Move generateSilentAudio to Composition
Also rename to forceAudioTrack

PiperOrigin-RevId: 510394620
2023-02-27 17:55:27 +00:00
kimvde
58d653b702 Rename occurences of transform in demo app
PiperOrigin-RevId: 510384933
2023-02-17 11:58:05 +00:00
tofunmi
d20c11442a Update demo app with image input
Adds a new option to the preset file list to show an image for 5secs at 30fps. Also adds an ImageView to show the input image

PiperOrigin-RevId: 510372035
2023-02-17 11:56:24 +00:00
kimvde
c2fdab847f Rename TransformationException to ExportException
PiperOrigin-RevId: 510062674
2023-02-17 11:42:50 +00:00
huangdarwin
cf768329e6 Effect: Rename FrameProcessor
Rename FrameProcessor to VideoFrameProcessor, and GlEffectsFrameProcessor to
DefaultVideoFrameProcessor.

Most changes are semi-mechanical, semi-manual find-replace, preserving case:
* "FrameProc" -> "VideoFrameProc" (ex. FrameProcessor -> VideoFrameProcessor, and
   FrameProcessingException -> VideoFrameProcessingException)
* "GlEffectsVideoFrameProc" -> "DefaultVideoFrameProc"

PiperOrigin-RevId: 509887384
2023-02-17 11:41:06 +00:00
kimvde
c434cc0c9f Rename TransformationResult to ExportResult
Also replace some usages of deprecated Transformer listeners with the new
ones.

PiperOrigin-RevId: 507743860
2023-02-08 14:06:51 +00:00
huangdarwin
ca4d2be1fa Effect: Rename TextureProcessor to ShaderProgram.
Also, replace instances of "texture processor" to "shader program", with capitalization retained.

PiperOrigin-RevId: 507515655
2023-02-08 14:04:09 +00:00
kimvde
0eb11e269c Rename startTransformation to start
Also update some Javadoc in Transformer

PiperOrigin-RevId: 507395956
2023-02-08 13:59:41 +00:00
huangdarwin
c4faae6b03 Demo: Request READ_MEDIA_VIDEO on API 33+
More info in: https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions

PiperOrigin-RevId: 506908079
2023-02-08 13:56:06 +00:00
claincly
4a1cf3d839 Support flushing in FrameProcessor
Flushing resets all the texture processors within the `FrameProcessor`. This
includes:

- At the back, the FinalMatrixTextureProcessorWrapper, and its MatrixTextureProcessor
- At the front, the ExternalTextureManager
- All the texture processors in between
- All the ChainingGlTextureProcessorListeners in between texture processors
- All the internal states in the aforementioned components

The flush process follows the order, from `GlEffectsFrameProcessor.flush()`

1. Flush the `FrameProcessingTaskExecutor`, so that after it returns, all tasks queued before calling `flush()` completes
2. Post to `FrameProcessingTaskExecutor`, to flush the `FinalMatrixTextureProcessorWrapper`
3. Flushing the `FinalMatrixTextureProcessorWrapper` will propagate flushing through, via the `ChainingGlTextureProcessorListener`

Startblock:
   has LGTM from christosts
   and then
   add reviewer andrewlewis
PiperOrigin-RevId: 506296469
2023-02-02 15:33:05 +00:00
andrewlewis
4fb651b116 Instantiate SurfaceView on main thread
On some devices/builds it seems that the `SurfaceView` constructor tries to create a handler. Move instantiation to the main thread when getting the debug surface view so that handler creation succeeds.

PiperOrigin-RevId: 505745387
2023-02-01 10:36:12 +00:00