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

Twitch TV API accessing property name value and updating it

本文关键字:更新 TV API 访问 属性 Twitch      更新时间:2023-09-26

我使用JSON创建了一个Twitch TV缩略图列表。我想创建一个选项,我可以在其中单击缩略图和弹出选项卡,其中包含该视频。为此,我需要访问 API 代码"选项"属性并更改"通道"值。我尝试访问该属性并更改函数 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>

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

tmutton正确回答了这个问题。让我解释一下我为所有人做了什么。在函数弹出窗口中将属性"选项"通道"值更改为"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);
            }