gpt4 book ai didi

javascript - 如何显示其他网站的视频内容

转载 作者:行者123 更新时间:2023-12-03 08:28:12 25 4
gpt4 key购买 nike

好吧,我想在我的网站上有很多视频可供选择,所有这些视频都来自 archive.org。我最初认为可能是一个 iframe,当用户单击视频标题时,iframe 源会更改为所选视频。只是想知道有没有更好的方法?欢迎任何建议和建议。archive.org 的 iframe 以及我尝试过的播放列表。

  <script>
jwplayer("playa").setup({
"playlist": [
{ duration:5,
title:"camels",
image:"https://archive.org/download/camels/format=Thumbnail",
sources:[
{file:"https://archive.org/download/camels/camels.mp4"},
{file:"https://archive.org/download/camels/camels.ogv"} ]
},
{ duration:115,
title:"commute",
image:"https://archive.org/download/commute/format=Thumbnail",
sources:[
{file:"https://archive.org/download/commute/commute.mp4"},
{file:"https://archive.org/download/commute/commute.ogv"} ]
},
{ duration:5717,
title:"night of the living dead",
image:"https://archive.org/download/night_of_the_living_dead/format=Thumbnail",
sources:[
{file:"https://archive.org/download/night_of_the_living_dead/night_of_the_living_dead_512kb.mp4"},
{file:"https://archive.org/download/night_of_the_living_dead/night_of_the_living_dead.ogv"} ]
}
],
"startparam":"start",
"repeat":"list",
"width":714,
// adjust these 2 lines if you'd like to omit/resize playlist, etc:
listbar:{position:"bottom",size:100,layout:"basic"},
"height":360,
});
</script></div>
<div id="playa"> </div>

但这并不是我想要的。抱歉,它的范围非常广泛,我只是不知道如何尝试。

最佳答案

就像这个 JSFiddle ,我正在使用属性 href 的值每个链接 <a>将其注入(inject)为 src iframe 中的值元素

JS:

$('.links').on('click', function(evt){
evt.preventDefault();
var vidSrc = $(this).attr('href');
$('iframe').attr('src', vidSrc);
});

HTML:

<div id="titles">
<a class="links" href="https://archive.org/embed/FinalFantasy2_356">Final Fantasy 2</a>
<a class="links" href="https://archive.org/embed/MortalKombatSM_14337">Mortal Kombat SM</a>
<a class="links" href="https://archive.org/embed/Quake4_20954">Quake4</a>
</div>
<iframe src="" width="400" height="300" frameborder="0"></iframe>

关于javascript - 如何显示其他网站的视频内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33459309/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com