Can not call embed player's method

I embed a play using official embed method
my code

    <meta name="viewport" content="width=device-width, height=device-height">
<script src= ""></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.addEventListener(Twitch.Player.READY, function(){
    console.log("player ready");;

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

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.