Search code examples
codenameonehttp-live-streaming

Does the com.codename1.components.MediaPlayer support HLS Adaptive Bitrate Streaming


The most mobile friendly adaptive bitrate streaming is HLS (HTTP Live Streaming).

The HLS is using a main m3u8 manifest file to mapping different screen resolutions with chunks of media files and serving the appropriate resolution according to client screen resolution and network fluctuation.

I have checked code of your KitchenSink app and I see that you MediaPlayer is serving mp4 files. Have any of you tried to replace the mp4 links with m3u8 manifests ? Is it supposed to work ? Do you consider to include the existing solution in your MediaPlayer => https://github.com/videojs/videojs-contrib-hls .


Solution

  • Media relies on native OS playback so if a native codec is supported by the OS it just works.

    The main motivation is in avoiding the problematic nature of media which is a realm of patent litigation and complexity.

    If the native platform supports a codec it will work, we used 264 since it's universally supported which is damn rare. Our simulator uses JavaFX for video playback and their codec support is "problematic" so 264 is probably the only approach we could pick that would work in the simulator and all the devices.

    Having said that if you have a pure Java implementation of a codec you can probably port it to Codename One. The JavaScript version of the codec above might work too in the web browser component but probably won't work in the simulator as the webview from JavaFX is pretty weak in terms of HTML5 support but it might work on devices.