Flowplayer 自动播放播放列表,视频之间有延迟

发布于 2024-12-01 13:14:27 字数 1508 浏览 0 评论 0原文

有谁知道如何在播放列表的每个剪辑的末尾添加延迟。 我正在尝试这样的事情:

flowplayer("a.flowplayer", {src: "/flowplayer2/dist/swf/flowplayer-3.2.7.swf",wmode: 'transparent'}, {
    clip: {
        onFinish: function(clip) {
           this.pause();
           var obj = this;
           setTimeout(function(){
              obj.play()
           },5*1000);

        },
    },
    plugins: {
        controls: {
            autoHide: "always"
        },
        ova: {
            url: '/flowplayer2/dist/swf/d/ova.swf',
            "autoPlay" : true,
            "autoBuffering": true,
            "shows": {
                "streams": [
                    { "file":"one.flv"},
                    { "file":"two.flv"},
                    { "file":"three.flv"}
                ]
            },
            "ads": {
                "pauseOnClickThrough": true,
                "displayCompanions": true,
                "restoreCompanions": false,
                "companions": [{
                    "id":"lcBannerDiv",
                    "width":"300",
                    "height":"250",
                    "resourceType": "iframe"
                }],
                "notice": { show: false },
                "schedule": [{
                    "position": "pre-roll",
                    "server": {
                        "type": "direct",
                        "tag": VAST_URL
                    }
                }]
            }
        }
    }
});

但它不起作用,它在播放第一个视频后就停止了。

谢谢你, 德米特里

Does anyone know how to add delay at the end of each clip of playlist.
I was trying something like this:

flowplayer("a.flowplayer", {src: "/flowplayer2/dist/swf/flowplayer-3.2.7.swf",wmode: 'transparent'}, {
    clip: {
        onFinish: function(clip) {
           this.pause();
           var obj = this;
           setTimeout(function(){
              obj.play()
           },5*1000);

        },
    },
    plugins: {
        controls: {
            autoHide: "always"
        },
        ova: {
            url: '/flowplayer2/dist/swf/d/ova.swf',
            "autoPlay" : true,
            "autoBuffering": true,
            "shows": {
                "streams": [
                    { "file":"one.flv"},
                    { "file":"two.flv"},
                    { "file":"three.flv"}
                ]
            },
            "ads": {
                "pauseOnClickThrough": true,
                "displayCompanions": true,
                "restoreCompanions": false,
                "companions": [{
                    "id":"lcBannerDiv",
                    "width":"300",
                    "height":"250",
                    "resourceType": "iframe"
                }],
                "notice": { show: false },
                "schedule": [{
                    "position": "pre-roll",
                    "server": {
                        "type": "direct",
                        "tag": VAST_URL
                    }
                }]
            }
        }
    }
});

but it doesn't work, it just stops after playing first video.

Thank you,
Dmitry

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

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

发布评论

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

评论(1

遥远的她 2024-12-08 13:14:27

我从未使用过 Flowplayer 的 OVA 插件,但从技术上讲,您的 onFinish 函数只是暂停播放器,然后再次播放。我想,然后它会转到剪辑的末尾并停止。

如果您的播放器从 OVA 插件获得了播放列表(您可以通过调用 $f().getPlaylist() 在 JavaScript 控制台上检查此内容,它会返回剪辑数组),然后考虑更改您的 onFinish 函数,例如这:

flowplayer("a.flowplayer", {src: "/flowplayer2/dist/swf/flowplayer-3.2.7.swf",wmode: 'transparent'}, {
    clip: {
        onFinish: function(clip) {
            // First check where you are in your playlist
            var currentClipIndex = this.getClip().index;
            // Get length of playlist
            var playlistLength = this.getPlaylist().length;
            // save handle to player instance
            var fp = this;
            // check if there is a clip after the current (last clip has index "playlistLength -1")
            if (currentClipIndex < playlistLength -1) {
                setTimeout(function() {
                    // tell fp to play clip with next index
                    fp.play(currentClipIndex + 1);
                // in five seconds
                }, 5*1000)
            }
        },
    },
    {...}
});

I never used OVA plugin for Flowplayer, but technically your onFinish function just pauses the player and after that it plays again. Then it goes to the end of the clip and stops, I think.

If your player got a playlist from OVA plugin (you can check this on JavaScript console via calling $f().getPlaylist(), it returns an array of clips), then consider changing your onFinish function like this:

flowplayer("a.flowplayer", {src: "/flowplayer2/dist/swf/flowplayer-3.2.7.swf",wmode: 'transparent'}, {
    clip: {
        onFinish: function(clip) {
            // First check where you are in your playlist
            var currentClipIndex = this.getClip().index;
            // Get length of playlist
            var playlistLength = this.getPlaylist().length;
            // save handle to player instance
            var fp = this;
            // check if there is a clip after the current (last clip has index "playlistLength -1")
            if (currentClipIndex < playlistLength -1) {
                setTimeout(function() {
                    // tell fp to play clip with next index
                    fp.play(currentClipIndex + 1);
                // in five seconds
                }, 5*1000)
            }
        },
    },
    {...}
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文