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

How can I display video content from another site

本文关键字:网站 的视频 其他 何显示 显示      更新时间:2023-09-26

好的,所以我想在我的网站上有很多视频可供选择,所有这些视频都来自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中,我使用每个链接<a>的属性href的值将其作为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>