使用jquery动态加载Vimeo视频

发布于 2024-11-25 13:42:53 字数 160 浏览 3 评论 0原文

我想创建一个功能,允许我将 Vimeo 视频嵌入到我的网站上,并像 YouTube 播放列表一样运行它,即当单击视频链接时,它不会重新加载页面,而只会重新加载视频。例如,这是一个电影网站,我有一个该项目的预告片以及一些宣传剪辑,我希望能够通过简单地让用户单击加载新视频的链接来显示所有这些内容。我该怎么做?

I would like to create a function that would allow me to embed my Vimeo videos on my website and run it like a YouTube playlist i.e. when a video link is clicked, rather than reloading the page it only reloads the video. So for example, this being a film website, I have a trailer for the project as well as a few promo clips, I would like to be able to show all of those by simply having the user click a link which loads a new video. How would I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

水溶 2024-12-02 13:42:53

这也应该有效。

$('#some_video_container').html('<iframe src="http://player.vimeo.com/video/12345?
                                 title=1&byline=1&portrait=1" width="643"
                                 height="360" frameborder="0"></iframe>');

this should work too.

$('#some_video_container').html('<iframe src="http://player.vimeo.com/video/12345?
                                 title=1&byline=1&portrait=1" width="643"
                                 height="360" frameborder="0"></iframe>');
幽蝶幻影 2024-12-02 13:42:53

干得好。

$.getJSON('http://www.vimeo.com/api/oembed.json?url=' + encodeURIComponent('http://vimeo.com/7100569') + '&width=300&callback=?', function(data){
        $('#some_video_container').html(data.html);
});

Here you go.

$.getJSON('http://www.vimeo.com/api/oembed.json?url=' + encodeURIComponent('http://vimeo.com/7100569') + '&width=300&callback=?', function(data){
        $('#some_video_container').html(data.html);
});
甜中书 2024-12-02 13:42:53

查看 oembed。我所知道的最好的提供商是 http://embed.ly

官方 JQuery Embed.ly 插件在这里:https://github.com/embedly/embedly-jquery

Checkout oembed. The best provider I know of is http://embed.ly

The official JQuery Embed.ly plugin is here: https://github.com/embedly/embedly-jquery

南薇 2024-12-02 13:42:53

我还使用过 Vimeo 播放列表,可在此处找到: http://luwes.co/labs/vimeo-playlist /

您可以设置播放列表列表的位置(视频的顶部、底部或侧面)。总的来说,设置起来非常容易。您只需将视频网址放入脚本中的数组中即可:

<div id="player"></div>
<script src="http://luwes.co/vimeowrap.js/vimeowrap.js"></script>
<script src="http://luwes.co/vimeowrap.js/vimeowrap.playlist.js"></script>
<script>
    vimeowrap('player').setup({
        urls: [
            'https://vimeo.com/user3709818',
            'https://vimeo.com/user3709818'
        ],
        plugins: {
            'playlist':{}
        }
    });
</script>

I've also used Vimeo Playlist, found here: http://luwes.co/labs/vimeo-playlist/

You can set where you want the playlist list (on top, bottom or side of the video). Overall it's pretty easy to set up. You just put your video urls in an array in the script:

<div id="player"></div>
<script src="http://luwes.co/vimeowrap.js/vimeowrap.js"></script>
<script src="http://luwes.co/vimeowrap.js/vimeowrap.playlist.js"></script>
<script>
    vimeowrap('player').setup({
        urls: [
            'https://vimeo.com/user3709818',
            'https://vimeo.com/user3709818'
        ],
        plugins: {
            'playlist':{}
        }
    });
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文