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
116 stars 8 forks source link

Mediaplayer crashes on web #28

Closed slickorange closed 2 months ago

slickorange commented 2 months 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 2 months ago

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

slickorange commented 2 months 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 2 months ago

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

slickorange commented 2 months 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 2 months 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 2 months 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 2 months 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

KhubaibKhan4 commented 2 months ago

@slickorange Thank you for your suggestions. I just fixed this issue and updating the latest version on the Maven Central. If you've any suggestions Please let me know.