gpt4 book ai didi

javascript - oncanplay 与 oncanplaythrough

转载 作者:行者123 更新时间:2023-11-29 23:09:21 27 4
gpt4 key购买 nike

两者都在代码中起作用。应该使用哪个?

radio 流会被认为是什么? http://hi5.1980s.fm/ ;

oncanplay

https://jsfiddle.net/vhgL96se/142/

The canplay event is fired when the user agent can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.

The browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.

player.oncanplay = function () {
if (value.value !== "") {
canPlay = true;
playPauseIcon(true);
}
};

oncanplaythrough

https://jsfiddle.net/vhgL96se/144/

The canplaythrough event is fired when the user agent can play the media and estimates that enough data has been loaded to play the media up to its end without having to stop for further buffering of content.

The browser estimates it can play the media up to its end without stopping for content buffering.

player.oncanplaythrough = function () {
if (value.value !== "") {
canPlay = true;
playPauseIcon(true);
}
};

最佳答案

您可以使用oncanplay。但在某些网络浏览器中它并不可靠,因此通常人们会同时使用这两种事件。

因为当 readyState 确实发生变化时会触发这两个事件,您可以使用 player.readyState 来确定当前状态并决定如果事件发生在您设置监听器之前该怎么做.

html.spec media page url

关于javascript - oncanplay 与 oncanplaythrough,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54101523/

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