Deaths-Door / astroplayer-kt

AstroPlayer is an open-source media player designed for the Kotlin Multiplatform. It provides a simple API for audio playback and supports multiple media formats while also providing an Jetpack Compose UI.
https://deaths-door.github.io/astroplayer-kt/
6 stars 1 forks source link

Status of WebAssembly support #9

Open AndrazP opened 1 week ago

AndrazP commented 1 week ago

Hi,

I stumbled on your project when looking for a library that supports audio playback on Kotlin WASM. README mentions WASM support is in the early stage, but does it work?

I had issues running your project. After cloning the project I had to:

  1. Update target Java from 11 to 17
  2. Change library destination because I can't find the library published on Maven.:
    implementation(project(":astroplayer-core"))
    implementation(project(":astroplayer-ui"))

Now when trying to run: ./gradlew wasmJsRun I get the following error:

Module parse failed: Unexpected token (3840:156) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | 'kotlinx.coroutines.clearTimeout' : (handle) => { if (typeof clearTimeout !== 'undefined') clearTimeout(handle); }, | 'kotlinx.coroutines.setTimeout_$externalfun' : (p0, p1) => setTimeout(p0, p1), 'com.deathsdoor.astroplayer.core.createHowlProperties' : (source, volume, html5, loop, preload, autoplay, mute, rate) => { src : ["source"] ,volume : volume, html : html5,loop : loop, preload : preload, autoplay : autoplay, mute : mute , rate : rate }, | 'com.deathsdoor.astroplayer.core.Howl$external_fun' : (p0) => new _refaG93bGVy.default(p0), | 'com.deathsdoor.astroplayer.core.release_$external_fun' : (_this, ) => _this.unload(),

github-actions[bot] commented 1 week ago

Hi @AndrazP! đź‘‹

Thank you for opening your first issue in the astroplayer-kt repository! We appreciate your interest in contributing to the project. Our community and maintainers will review your issue soon.

In the meantime, please make sure to:

Thanks for helping us improve AstroPlayer!

Deaths-Door commented 1 week ago

@Andraz To be concise, does it work - I don't really know.

I haven't had the time to check the wasm target yet, but I've started checking the wasm target locally.

If you have any finds or fixes , please feel free to open a pull request.

Back to your message

Change library destination because I can't find the library published on Maven.:

As I mentioned in the README.md files that it's only published to maven local not maven , I used the composeApp module to test, whether the publishing works

And back to your error, I've been experiencing that as well , and I'm trying to fix it. My guess is that the web doesn't allow accessing local files using a file path

Reference https://github.com/goldfire/howler.js/issues/724#issue-215541558