mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 09:41:20 -08:00
fix(audio): [PKG-AUDIO-05] checkpoint zero-time resume and native buffering evidence
This commit is contained in:
1 parent
0218196df9
commit
d18c545675
25 files changed
+14373
-32
No files matched your search
@@ -84,6 +84,14 @@ function artplayerPluginAudioTrack(option) {
|
||||
if (art.video)
|
||||
track.sync(art.currentTime);
|
||||
}
|
||||
function canResumeAudio() {
|
||||
const video = art.video;
|
||||
if (!video)
|
||||
return false;
|
||||
if ("playing" in video && typeof video.playing === "boolean")
|
||||
return video.playing;
|
||||
return art.playing || video.paused === false && !video.ended && video.readyState > 2;
|
||||
}
|
||||
function listen(event, callback) {
|
||||
const listener = () => {
|
||||
if (active)
|
||||
@@ -122,7 +130,7 @@ function artplayerPluginAudioTrack(option) {
|
||||
listen("seek", syncAudio);
|
||||
listen("video:seeked", () => {
|
||||
syncAudio();
|
||||
if (art.playing)
|
||||
if (canResumeAudio())
|
||||
track.play();
|
||||
});
|
||||
listen("video:timeupdate", () => {
|
||||
@@ -137,7 +145,13 @@ function artplayerPluginAudioTrack(option) {
|
||||
audio.muted = art.muted;
|
||||
});
|
||||
listen("video:playing", () => {
|
||||
if (art.playing) {
|
||||
if (canResumeAudio()) {
|
||||
syncAudio();
|
||||
track.play();
|
||||
}
|
||||
});
|
||||
listen("video:canplay", () => {
|
||||
if (audio.paused && canResumeAudio()) {
|
||||
syncAudio();
|
||||
track.play();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user