google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.75k stars 6.03k forks source link

Add Official Support for JetPack Compose #9654

Open buddudevelopers opened 3 years ago

buddudevelopers commented 3 years ago

Before filing a feature request:

When filing a feature request:

Replace the content in the sections below.

[REQUIRED] Use case description

It would be great to support Jetpack compose. Currently its not supported yet its an official google way of building UI on android.

Proposed solution

A clear and concise description of your proposed solution, if you have one.

Alternatives considered

There are tutorial online of adding exoplayer to AndroidView but there are reports of performance issues. like this example repo https://github.com/spencergriffin/exoplayer-compose

re-ovo commented 2 years ago

Strongly agree, it should be supported to call it declaratively instead of via AndroidView{}

imherrera commented 2 years ago

I made an implementation which is very flexible and declarative, though only the basic features are implemented so far. Mind to take a look? compose-video-player

DonnyRozendal commented 2 years ago

Any updates on this? Quite some time has passed, and the performance on Compose is not ideal I would say. Seeing some black screens when rendering the View and it looks glitchy at times.

yoobi commented 2 years ago

Hello,

Could you give us some details on how/when you're planning to support Compose ?

Thank you

alaegin commented 2 years ago

This is great example on how to implement ExoPlayer in Compose way https://github.com/fengdai/compose-media

joshuamking commented 1 year ago

This is crazy it's just been silence for so long. Could we at least get some kind of response, even if you don't know when? Are you ever planning on supporting compose natively without an AndroidView, this is causing many problems.

gajicm93 commented 1 year ago

Are you ever planning on supporting compose natively without an AndroidView, this is causing many problems.

For those that still use an AndroidView though, take a look at this issue, because Compose devs just recently implemented view reusability for AndroidViews inside Compose: https://issuetracker.google.com/issues/230099236

JolandaVerhoef commented 1 year ago

Thank you for this request. We're aware that support for Jetpack Compose is highly requested and we're looking into it.

As part of supporting Compose, the media3 library needs a Kotlin-friendly API, which is why we're prioritizing work on https://github.com/androidx/media/issues/599 first

akardas16 commented 3 months ago

this should be prioritized. Adding Exoplayer in Androidview causes weird problems (out of memory, lifecycle problems, black screen)

JolandaVerhoef commented 3 months ago

As mentioned before, we are actively working on this. However, a full rewrite from Views to Compose for this library is extensive, and will take a while to fully land. In the meantime, do raise issues you find with the current solution. Please include a reproducible sample and stack trace with these issues so we can investigate.

In the meantime, we have recently merged the first Kotlin API in the common library. This is a prerequisite for Compose support. Here's the changes:

Please try it out by running the latest main on your machine. We're happy to hear feedback.