Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/478.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Twitch TV API访问属性名称值并更新它_Javascript_Jquery_Api - Fatal编程技术网

Javascript Twitch TV API访问属性名称值并更新它

Javascript Twitch TV API访问属性名称值并更新它,javascript,jquery,api,Javascript,Jquery,Api,我已经使用JSON创建了Twitch TV缩略图列表。我想创建一个选项,在那里我可以点击缩略图和弹出标签与视频出现。为此,我需要访问API代码“options”属性并更改“channel”值。 我尝试访问该属性并更改函数popup()中的值,该函数通过单击缩略图触发 <div id="popup"> <div id="videoWrapper"> <script src= "http://player.twitch.tv/js/embed/v1.js">&l

我已经使用JSON创建了Twitch TV缩略图列表。我想创建一个选项,在那里我可以点击缩略图和弹出标签与视频出现。为此,我需要访问API代码“options”属性并更改“channel”值。 我尝试访问该属性并更改函数popup()中的值,该函数通过单击缩略图触发

<div id="popup">
<div id="videoWrapper">

<script src= "http://player.twitch.tv/js/embed/v1.js"></script>
<div id="test"></div>
<script type="text/javascript">
    var options = {
        width: 600,
        height: 315,
        channel: "monstercat", 
        //video: "v123456789"   
    };
    var player = new Twitch.Player("test", options);
    player.setVolume(0.01);
    //player.setMuted(true);



        //Popup Tab with streaming video
            function popup(){
                $('#popup').show();
                options.channel = 'nl_kripp';   
            }


</script>

变量选项={
宽度:600,
身高:315,
频道:“怪物猫”,
//视频:“v123456789”
};
var player=新的Twitch.player(“测试”,选项);
播放器设置音量(0.01);
//player.setmute(true);
//带流式视频的弹出选项卡
函数popup(){
$('弹出窗口').show();
options.channel='nl_kripp';
}

你可能知道我在这里做错了什么,因为这不起作用吗?

t按钮正确回答了这个问题。让我解释一下我为其他人做了什么。 在函数弹出窗口中将属性“options”“channel”值更改为“nl_kripp”后,我需要再次调用Api

            //Popup Tab with streaming video
            function popup(){
                $('#popup').show();
                var player = 'none';
                options.channel = 'nl_kripp';

                var player = new Twitch.Player("test", options);
            }

您需要更改通道字段,然后再次调用api。是的,您完全正确。非常感谢。