Unsolved how to create js object in qml ?
-
How to create an object from this js file
https://cdn.jsdelivr.net/hls.js/latest/hls.min.jsit should work like this
import "hls.min.js" as HLSPlayer . . . Component.onCompleted: { var hls = new HLSPlayer(); hls.loadSource(streamUrl); hls.attachMedia(player); hls.on(HLSPlayer.Events.MANIFEST_PARSED,function() { player.play() }); }
but it says "TypeError: Type error" in this line "var hls = new HLSPlayer();"
is there any solution ?
-
Hello,
If you want to create an object of JS file in QML, you need to do like this
import "hls.min.js" as HLSPlayer
.
.
.
Component.onCompleted: {HLSPlayer.loadSource(streamUrl);
HLSPlayer.attachMedia(player);}