Is it possible to use HTML with a compose Multipla...
# compose
h
Is it possible to use HTML with a compose Multiplatform for a js target? I am trying to build a cross platform media player so I am using expect/actual to implement a platform specific compose function. I want my js target to use a default html5 audio player tag.. is this possible?
h
Compose multi-platform only supports WasmJs for the web. Compose HTML is a library targeting Kotlin/Js that provides Composable building blocks for creating web user interfaces with HTML and CSS (but is not part of the Compose multiplatform!). See the readme of https://github.com/JetBrains/compose-multiplatform
a
Compose HTML is not a multiplatform library, but it is part of Compose Multiplatform.
h
I am feeling really stupid but I am struggling to find documentation on Compose Html
o
Compose multi-platform only supports WasmJs for the web.
Not true, you can use Compose Web on the JS target instead of Wasm: https://kotlinlang.slack.com/archives/C01F2HV7868/p1717017795372079?thread_ts=1716859498.581779&cid=C01F2HV7868 If a cross platform media player is meant to work like other Composables on Mobile, Compose HTML is not an option. It has an entirely different API. Best starting point to explore it are the examples: https://github.com/JetBrains/compose-multiplatform/tree/master/examples/html The well known multiplatform Compose (sometimes referred to as "Compose UI" to distinguish it from Compose HTML) in the browser is Compose Web. It renders its stuff into an HTML canvas element. Theoretically, you could create a Composable that layouts a placeholder area in Compose Web, then place a carefully positioned HTML overlay on top of that, but it's probably not going to be easy.
🙌 1
h
Thanks @Oliver.O I thought I would be able to render HTML elements on the JS side but I realize now with they way it works with the Skia rendered canvas its not so simple. I will take a look at the project you shared, looks interesting!
👍 1
781 Views