KhubaibKhan4 / MediaPlayer-KMP

MediaPlayer-KMP is a Kotlin Multiplatform (KMP) library that allows you to display and play YouTube videos across Android, iOS, Web, and Desktop platforms using JetBrains Compose Multiplatform. It provides a unified API for video playback that seamlessly integrates into Kotlin's multiplatform ecosystem.
GNU General Public License v2.0
78 stars 6 forks source link

Mediaplayer crashes on web #28

Open slickorange opened 2 weeks ago

slickorange commented 2 weeks ago

When trying to use the MediaPlayer in a web app, the web app freezes.

I see the following error in the console:

IllegalStateException: CompositionLocal LayerContainer not provided
KhubaibKhan4 commented 1 week ago

Provide me full error details like video URL and screen shot as well.

slickorange commented 1 week ago

I will try to provide more details later. I cannot share the URL as it is on a local development server. I will try different public URLs to see if it is an issue with my specific file.

A screenshot wont help - the app just freezes with that message in the browser development tools console

KhubaibKhan4 commented 1 week ago

Basically, that app freezes due to the wrong URL. I'll try to include the encoded URL asap.

slickorange commented 1 week ago

Thanks! I have checked now - even with the example URL the web app just freezes with the error in the console.

MediaPlayer(
                    modifier = Modifier.fillMaxWidth(),
                    url = "https://commondatastorage.googleapis.com/codeskulptor-demos/DDR_assets/Kangaroo_MusiQue_-_The_Neverwritten_Role_Playing_Game.mp3",
                    startTime = MaterialTheme.colorScheme.primary,
                    endTime = MaterialTheme.colorScheme.primary,
                    volumeIconColor = MaterialTheme.colorScheme.primary,
                    playIconColor = MaterialTheme.colorScheme.primary,
                    sliderTrackColor = MaterialTheme.colorScheme.primary,
                    sliderIndicatorColor = MaterialTheme.colorScheme.primary,
                )
KhubaibKhan4 commented 1 week ago

I'll definitely check out the update soon. I just ordered a new MacBook. Waiting for that and will definitely update This library on One sprint.

KhubaibKhan4 commented 1 week ago

I'll definitely check out the update soon. I just ordered a new MacBook. Waiting for that and will definitely update This library on One sprint.

slickorange commented 1 week ago

Thank you! I appreciate it.

It seems to be failing at this line, I don't know why: https://github.com/KhubaibKhan4/MediaPlayer-KMP/blob/1f93c1ae12d897169f812625db1d149cdc8c3d6d/mediaplayer-kmp/src/jsMain/kotlin/HtmlWeb.kt#L145