I embed a play using official embed method https://dev.twitch.tv/docs/embed/video-and-clips/#interactive-frames-for-live-streams-and-vods
my code
<html>
<head>
<meta name="viewport" content="width=device-width, height=device-height">
</head>
<body>
<script src= "https://player.twitch.tv/js/embed/v1.js"></script>
<div id="SamplePlayerDivID" style="width: 100%; height: 100%"></div>
<script type="text/javascript">
var options = {
width: 800,
height: 600
};
var player = new Twitch.Player("SamplePlayerDivID", options);
player.setChannel("a541021");
player.addEventListener(Twitch.Player.READY, function(){
console.log("player ready");
player.play();
});
</script>
</body>
</html>
and i open the html using chrome and it can not play live stream (i’m sure it’s living in than channel) and no log print in console.
I copied and pasted your code into a HTML file and opened it.
I cannot replicate and issue. It just works™
thank you for your reply.
I find you open it in local server and I just double-click to open it. Or maybe something wrong with my chrom?
But now, I can play the stream by loading the html file to android webview.
so, My problem has been solved.
Yeah I tested in file:// original, then remembered that it’s “web code” and should be tested under http:// or https://
Android Webview is the way to go on a droid device
system
Closed
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.