mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-16 09:36:16 -08:00
Merge branch 'master' of https://github.com/zhw2590582/ArtPlayer
This commit is contained in:
commit
b84b0af2ec
25 files changed
+94
-106
No files matched your search
@@ -50,7 +50,7 @@ export default function createAudioEngine(events) {
|
||||
return
|
||||
|
||||
const AudioContext
|
||||
= window.AudioContext || window.webkitAudioContext
|
||||
= window.AudioContext || window.webkitAudioContext
|
||||
|
||||
try {
|
||||
audioContext = new AudioContext({ sampleRate })
|
||||
@@ -195,8 +195,8 @@ export default function createAudioEngine(events) {
|
||||
node.playbackRate.value = _playbackRate
|
||||
|
||||
const startAt
|
||||
= audioContextStartTime
|
||||
+ (timestamp - playbackTimeAtStart) / _playbackRate
|
||||
= audioContextStartTime
|
||||
+ (timestamp - playbackTimeAtStart) / _playbackRate
|
||||
|
||||
const duration = buffer.duration
|
||||
const endAt = startAt + duration / _playbackRate
|
||||
|
||||
@@ -16,16 +16,16 @@ export default function createMediabunnyEngine({
|
||||
}
|
||||
|
||||
const audio = createAudioEngine(events)
|
||||
const video = createVideoEngine({
|
||||
canvas,
|
||||
ctx,
|
||||
events,
|
||||
timeupdateInterval: option.timeupdateInterval ?? defaults.timeupdateInterval,
|
||||
avSyncTolerance: option.avSyncTolerance ?? defaults.avSyncTolerance,
|
||||
dropLateFrames: option.dropLateFrames ?? defaults.dropLateFrames,
|
||||
poster: option.poster ?? defaults.poster,
|
||||
preflightRange: option.preflightRange ?? false,
|
||||
})
|
||||
const video = createVideoEngine({
|
||||
canvas,
|
||||
ctx,
|
||||
events,
|
||||
timeupdateInterval: option.timeupdateInterval ?? defaults.timeupdateInterval,
|
||||
avSyncTolerance: option.avSyncTolerance ?? defaults.avSyncTolerance,
|
||||
dropLateFrames: option.dropLateFrames ?? defaults.dropLateFrames,
|
||||
poster: option.poster ?? defaults.poster,
|
||||
preflightRange: option.preflightRange ?? false,
|
||||
})
|
||||
|
||||
let _paused = true
|
||||
let _ended = false
|
||||
@@ -56,11 +56,11 @@ export default function createMediabunnyEngine({
|
||||
|
||||
let timer = null
|
||||
const timeoutPromise
|
||||
= loadTimeout > 0
|
||||
? new Promise((_, reject) => {
|
||||
timer = setTimeout(() => reject(new Error('Load timeout')), loadTimeout)
|
||||
})
|
||||
: null
|
||||
= loadTimeout > 0
|
||||
? new Promise((_, reject) => {
|
||||
timer = setTimeout(() => reject(new Error('Load timeout')), loadTimeout)
|
||||
})
|
||||
: null
|
||||
|
||||
const loadTask = (async () => {
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export default function sleep(ms) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms)
|
||||
})
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import type Artplayer from 'artplayer'
|
||||
|
||||
interface Option {
|
||||
type Option = {
|
||||
eventDelay?: number
|
||||
loadTimeout?: number
|
||||
timeupdateInterval?: number
|
||||
|
||||
Reference in new issue
Block a user