FlowPlayer onError - 更新剪辑 URL

发布于 2024-09-10 16:06:29 字数 415 浏览 8 评论 0原文

我希望在找不到流时更改剪辑的 URL。我正在正确配置 onError 事件,因为我可以调试特定行或添加警报,但我遇到的问题如下:

onError : function(errorCode, errorMessage) {
    this.getClip(0).update( { url : 'http://full-url.com/images/stream-not-found.png' } );
}

问题是该图像永远不会在出现错误时加载到播放器中 - 我得到未找到流错误消息,然后播放器继续寻找此“未找到”流。我可以点击 URL 并查看图像,但无法在找不到流时进行切换。根据文档,它应该能够将图像作为 URL,但使用完全限定或相对 URL 似乎不起作用。

这在某种程度上得到了简化,因为我们希望为每个错误代码使用自定义图像。

I am looking to change the URL of a clip when the stream is not found. I am properly configuring the onError event, as I can debug the specific line or add an alert, but what I am having trouble with is the following:

onError : function(errorCode, errorMessage) {
    this.getClip(0).update( { url : 'http://full-url.com/images/stream-not-found.png' } );
}

The problem is this image is never being loaded to the player upon the error -- I get a stream not found error message and then the player continues to look for this 'unfound' stream. I'm able to hit the URL and see the image, but am unable to change over upon stream not found. Per the documentation it is supposed to be able to take an image as the URL, but using a fully qualified or relative URL doesn't seem to be working.

This is somewhat simplified as we are looking to use customized images for each error code.

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

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

发布评论

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

评论(1

留蓝 2024-09-17 16:06:29

对此没有确定真正的答案,最好的办法是卸载播放器,并在加载播放器之前显示容器中的 HTML。

此时我们仍然有一个错误号,因此我们能够使用 jQuery 设置 html 以显示新图像。

我面前没有代码,但类似于:

onError: function(errorCode, errorMessage) {
    this.unload();
    switch (errorCode) {
        case 200:
            $('#idOfPlayer a').attr('src', link-to-200-error.jpg);
        break;
    }
}

No real answer was determined for this, the best that could be done was to unload the player, and display the HTML which was in the container prior to the player being loaded.

At that point we still had an error number, so we were able to then use jQuery to set the html to display the new image.

Don't have code in front of me, but was similar to:

onError: function(errorCode, errorMessage) {
    this.unload();
    switch (errorCode) {
        case 200:
            $('#idOfPlayer a').attr('src', link-to-200-error.jpg);
        break;
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文