我对此非常陌生,非常感谢您的帮助,谢谢!
jsfiddle http://jsfiddle.net/82wNq/38/的链接 链接到api https://github.com/justintv/Twitch-API/blob/master/v2_resources/streams.md#get-streamsfeatured
这是javascript:
$.getJSON("https://api.twitch.tv/kraken/search/streams?q=all&limit=3&type=suggest&callback=?", function (data) {
var temp = "";
$.each(data.streams, function (index, item) {
temp = temp + "<div class='panel-heading'><h3 class='panel-title'></h3><div id='content1'>" + item.channel.display_name + "</div><div id='content2'>" + item.viewers + "</div></div><div class='panel-body'><div id='content3'><img src='" + item.preview.medium + "'/></div></div>";
});
$("#content").html(temp);
});
这是我到目前为止的html:
<div id="content" class="panel panel-default"></div>
答案 0 :(得分:0)
根据他们的文档,将流提供给嵌入对象。
阅读:https://github.com/justintv/Twitch-API/blob/master/embedding.md
答案 1 :(得分:0)
下面是你想要的一个例子我已经为网站添加了搜索功能
jsfiddle - http://jsfiddle.net/F4tsM/10/
希望这有帮助
这是你需要的对象
var obj = "<object style=opacity:1; type=application/x-shockwave-flash" + " height=378 width=620 id=live_embed_player_flash bgcolor=#000000" + " data=http://www.twitch.tv/widgets/live_embed_player.swf?channel=" + item.channel.name + ">" + "<param name=allowFullScreen value=true /><param name=allowScriptAccess value=always />" + "<param name=allowNetworking value=all />" + "<param name=movie value=http://www.twitch.tv/widgets/live_embed_player.swf />" + "<param name=flashvars value=hostname=www.twitch.tv&channel=" + item.channel.name + "&auto_play=true&start_volume=25 />" + "</object>";
所有这些都在小提琴例子中