androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.74k stars 416 forks source link

Provide example of MediaItem as an image in Main Demo #1206

Closed omkarsurya closed 1 month ago

omkarsurya commented 8 months ago

Provide example of MediaItem as an image in Main Demo

I recently came across the setImageDurationMs here

Which allows to create a mediaitem using an image after we set the URI as an image

the main exoplayer demo provides example for various video and audio formats but there is no example for image as mediaitem

Please provide example for various image formats and specify which image formats like jpg, png etc are supported

Also is webp supported?

oceanjules commented 8 months ago

For setImageDurationMs -- Look like a duplicate of https://github.com/androidx/media/issues/1157, https://github.com/androidx/media/issues/1165, https://github.com/androidx/media/issues/1144

webp: https://github.com/androidx/media/blob/d13a0f4ec62ca092b79746a5725b62a3244cc5b4/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultAssetLoaderFactory.java#L209-L210

https://github.com/androidx/media/blob/d13a0f4ec62ca092b79746a5725b62a3244cc5b4/libraries/extractor/src/main/java/androidx/media3/extractor/DefaultExtractorsFactory.java#L560-L561

omkarsurya commented 8 months ago

the question is not about being able to display an image, I am asking will there be a demo application for various image types, As there are already example provided here for various video and audio files, similarly the demo application can have examples of image files .

icbaker commented 8 months ago

The demo app uses PlayerView which doesn't currently support image output: https://github.com/androidx/media/issues/1144

When the demo app supports displaying images we can add some example image assets.

pawaom commented 8 months ago

@icbaker can this be included in other demos like

surface

or

gl

AndreyMedal commented 1 month ago

Any ideas why compose demo doesn't work with images? I tried to add MediaSourceFactory, RenderersFactory and ImageDurationMs for MediaItem. But still I see only black screen for SURFACE_TYPE_SURFACE_VIEW. I think good example of usage images with compose will be useful.

tonihei commented 1 month ago

Image support in the UI modules has been implemented in 1.4.0, there are also some example images in the demo app and we added documentation on the guide pages: https://developer.android.com/media/media3/exoplayer/images

So I think we can close this bug as done.

@AndreyMedal the compose demo is work in progress and will eventually support images too.