This commit is contained in:
Harvey Zhao committed 2025-12-13 14:08:10 +08:00
commit b84b0af2ec
24 files changed
+76 -88

No files matched your search

+1 -1
View File
@@ -48,5 +48,5 @@ declare const artplayerPluginAds: (option: Option) => (art: Artplayer) => Ads
export default artplayerPluginAds
export = artplayerPluginAds
export = artplayerPluginAds;
export as namespace artplayerPluginAds;
+1 -1
View File
@@ -16,5 +16,5 @@ declare const artplayerPluginAmbilight: (option: Option) => (art: Artplayer) =>
export default artplayerPluginAmbilight
export = artplayerPluginAmbilight
export = artplayerPluginAmbilight;
export as namespace artplayerPluginAmbilight;
+1 -1
View File
@@ -22,5 +22,5 @@ declare function artplayerPluginAsr(option?: AsrPluginOption): (art: Artplayer)
export default artplayerPluginAsr
export = artplayerPluginAsr
export = artplayerPluginAsr;
export as namespace artplayerPluginAsr;
+1 -1
View File
@@ -13,5 +13,5 @@ declare const artplayerPluginAutoThumbnail: (option: Option) => (art: Artplayer)
export default artplayerPluginAutoThumbnail
export = artplayerPluginAutoThumbnail
export = artplayerPluginAutoThumbnail;
export as namespace artplayerPluginAutoThumbnail;
+1 -1
View File
@@ -17,5 +17,5 @@ declare const artplayerPluginChapter: (option: Option) => (art: Artplayer) => Re
export default artplayerPluginChapter
export = artplayerPluginChapter
export = artplayerPluginChapter;
export as namespace artplayerPluginChapter;
+1 -1
View File
@@ -13,5 +13,5 @@ declare const artplayerPluginChromecast: (option: Option) => (art: Artplayer) =>
export default artplayerPluginChromecast
export = artplayerPluginChromecast
export = artplayerPluginChromecast;
export as namespace artplayerPluginChromecast;
+1 -1
View File
@@ -21,5 +21,5 @@ declare const artplayerPluginDanmukuMask: (option?: Option) => (art: Artplayer)
export default artplayerPluginDanmukuMask
export = artplayerPluginDanmukuMask
export = artplayerPluginDanmukuMask;
export as namespace artplayerPluginDanmukuMask;
+1 -1
View File
@@ -255,5 +255,5 @@ declare const artplayerPluginDanmuku: (option: Option) => (art: Artplayer) => Re
export default artplayerPluginDanmuku
export = artplayerPluginDanmuku
export = artplayerPluginDanmuku;
export as namespace artplayerPluginDanmuku;
+1 -1
View File
@@ -13,5 +13,5 @@ declare const artplayerPluginDashControl: (option: { quality?: Config, audio?: C
export default artplayerPluginDashControl
export = artplayerPluginDashControl
export = artplayerPluginDashControl;
export as namespace artplayerPluginDashControl;
+1 -1
View File
@@ -18,5 +18,5 @@ declare const artplayerPluginDocumentPip: (option: Option) => (art: Artplayer) =
export default artplayerPluginDocumentPip
export = artplayerPluginDocumentPip
export = artplayerPluginDocumentPip;
export as namespace artplayerPluginDocumentPip;
+1 -1
View File
@@ -13,5 +13,5 @@ declare const artplayerPluginHlsControl: (option: { quality?: Config, audio?: Co
export default artplayerPluginHlsControl
export = artplayerPluginHlsControl
export = artplayerPluginHlsControl;
export as namespace artplayerPluginHlsControl;
+1 -1
View File
@@ -28,5 +28,5 @@ declare class ArtplayerPluginIframe {
export default ArtplayerPluginIframe
export = artplayerPluginIframe
export = artplayerPluginIframe;
export as namespace artplayerPluginIframe;
+1 -1
View File
@@ -11,5 +11,5 @@ declare const artplayerPluginAss: (options: Options) => (art: Artplayer) => {
export default artplayerPluginAss
export = artplayerPluginLibass
export = artplayerPluginLibass;
export as namespace artplayerPluginLibass;
+1 -1
View File
@@ -12,5 +12,5 @@ declare const artplayerPluginMultipleSubtitles: (option: {
export default artplayerPluginMultipleSubtitles
export = artplayerPluginMultipleSubtitles
export = artplayerPluginMultipleSubtitles;
export as namespace artplayerPluginMultipleSubtitles;
+1 -1
View File
@@ -29,5 +29,5 @@ declare function artplayerPluginVast(
export default artplayerPluginVast
export = artplayerPluginVast
export = artplayerPluginVast;
export as namespace artplayerPluginVast;
+1 -1
View File
@@ -6,5 +6,5 @@ declare const artplayerPluginVttThumbnail: (option: { vtt?: string, style?: Part
export default artplayerPluginVttThumbnail
export = artplayerPluginVttThumbnail
export = artplayerPluginVttThumbnail;
export as namespace artplayerPluginVttThumbnail;
+1 -1
View File
@@ -6,5 +6,5 @@ declare const artplayerProxyCanvas: (option?: Option) => (art: Artplayer) => Res
export default artplayerProxyCanvas
export = artplayerProxyCanvas
export = artplayerProxyCanvas;
export as namespace artplayerProxyCanvas;
+1 -1
View File
@@ -15,5 +15,5 @@ declare const artplayerProxyMediabunny: (option?: Option) => (art: Artplayer) =>
export default artplayerProxyMediabunny
export = artplayerProxyMediabunny
export = artplayerProxyMediabunny;
export as namespace artplayerProxyMediabunny;
+33 -1
View File
@@ -126,6 +126,8 @@ export interface Subtitle {
onVttLoad?: (vtt: string) => string
}
export interface SettingOption extends Omit<Setting, 'html' | 'icon' | 'tooltip'> {
html: string
icon: string | undefined
@@ -237,6 +239,10 @@ export interface Quality {
url: string
}
export type AspectRatio = 'default' | '4:3' | '16:9' | (`${number}:${number}` & Record<never, never>)
export type PlaybackRate = 0.5 | 0.75 | 1.0 | 1.25 | 1.5 | 1.75 | 2.0 | (number & Record<never, never>)
export type Flip = 'normal' | 'horizontal' | 'vertical' | (string & Record<never, never>)
@@ -346,6 +352,15 @@ export declare class Player {
reset(): void
}
export type CustomType
= | 'flv'
| 'm3u8'
@@ -754,6 +769,9 @@ declare module 'artplayer/i18n/*' {
export default lang
}
export type Bar = 'loaded' | 'played' | 'hover'
export interface Events {
@@ -977,6 +995,8 @@ export interface Config {
]
}
export interface Selector {
/**
* Whether the default is selected
@@ -1108,6 +1128,18 @@ export interface ComponentOption {
onSelect?: (this: Artplayer, selector: Selector, element: HTMLElement, event: Event) => void
}
export type {
Config,
Events,
@@ -1297,5 +1329,5 @@ export default class Artplayer extends Player {
} & Record<string, unknown>
}
export = Artplayer
export = Artplayer;
export as namespace Artplayer;
@@ -94,54 +94,7 @@
function localRequire(x) {
var res = localRequire.resolve(x);
if (res === false) {
return {};
}
// Synthesize a module to follow re-exports.
if (Array.isArray(res)) {
var m = {__esModule: true};
res.forEach(function (v) {
var key = v[0];
var id = v[1];
var exp = v[2] || v[0];
var x = newRequire(id);
if (key === '*') {
Object.keys(x).forEach(function (key) {
if (
key === 'default' ||
key === '__esModule' ||
Object.prototype.hasOwnProperty.call(m, key)
) {
return;
}
Object.defineProperty(m, key, {
enumerable: true,
get: function () {
return x[key];
},
});
});
} else if (exp === '*') {
Object.defineProperty(m, key, {
enumerable: true,
value: x,
});
} else {
Object.defineProperty(m, key, {
enumerable: true,
get: function () {
if (exp === 'default') {
return x.__esModule ? x.default : x;
}
return x[exp];
},
});
}
});
return m;
}
return newRequire(res);
return res === false ? {} : newRequire(res);
}
function resolve(x) {
@@ -616,7 +569,6 @@ function createMediabunnyEngine({ canvas, ctx, events, option = {} }) {
}
async function play() {
if (!_paused) return;
_ended = false;
_paused = false;
await audio.play();
video.start(audio);
@@ -632,7 +584,6 @@ function createMediabunnyEngine({ canvas, ctx, events, option = {} }) {
}
async function seek(time) {
const shouldResume = !_paused;
_ended = false;
_seeking = true;
events.emit('seeking');
events.emit('waiting');
@@ -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