gpt4 book ai didi

javascript - 从 Flowplayer 输出当前剪辑文件名或 URL

转载 作者:行者123 更新时间:2023-11-28 16:16:16 26 4
gpt4 key购买 nike

我正在尝试获取 Flowplayer 中当前正在播放的视频的文件名或 URL 并将其显示在我的节目 div 中。我以为我可以使用 getClip().completeUrl 但输出未定义。如果我执行的操作不是字符串,例如 getClip().fullDuration (整数),则输出将按预期工作。为什么我变得未定义?

这是我的 JavaScript:

function getURL(){
var url = flowplayer().getClip().completeUrl;
$("#show").empty();
$('#show').append(url);
}

这是我的 HTML:

<input type="button" id="get" value="Get URL" onclick="getURL()" />
<input type="text" id="show" name="show" />

这是播放器 JavaScript:

$f("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.11.swf", {
buffering : false,
clip: {
provider: 'rtmp',
baseUrl: 'http://example.com',

streams: [

{ url: 'flv:video123'},

]
},
plugins: {
rtmp: {
url: "flowplayer.rtmp-3.2.10.swf",
netConnectionUrl: 'rtmp://example.com/vod'
}
}

});

最佳答案

这就是Flowplayer documentation says关于completeUrl:

This is the concatenation of the clip's baseUrl property and the clip's url property. baseUrl is undefined if you did not set it explicitly.

如果您尚未设置baseUrl,这可能意味着无法构建completeUrl。但在本例中,无论如何它都与 url 相同,因此您可以使用那个。

var url = flowplayer().getClip().url;

更新

正如OP发现的那样,在使用RTMP流列表时显然没有completeUrl。但在使用没有流列表的 RTMP 时它可以工作。

关于javascript - 从 Flowplayer 输出当前剪辑文件名或 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11382360/

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