mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 22:01:20 -08:00
Merge branch 'master' of https://github.com/zhw2590582/ArtPlayer
This commit is contained in:
commit
b84b0af2ec
24 files changed
+76
-88
No files matched your search
+1
-1
@@ -48,5 +48,5 @@ declare const artplayerPluginAds: (option: Option) => (art: Artplayer) => Ads
|
|||||||
|
|
||||||
export default artplayerPluginAds
|
export default artplayerPluginAds
|
||||||
|
|
||||||
export = artplayerPluginAds
|
export = artplayerPluginAds;
|
||||||
export as namespace artplayerPluginAds;
|
export as namespace artplayerPluginAds;
|
||||||
+1
-1
@@ -16,5 +16,5 @@ declare const artplayerPluginAmbilight: (option: Option) => (art: Artplayer) =>
|
|||||||
|
|
||||||
export default artplayerPluginAmbilight
|
export default artplayerPluginAmbilight
|
||||||
|
|
||||||
export = artplayerPluginAmbilight
|
export = artplayerPluginAmbilight;
|
||||||
export as namespace artplayerPluginAmbilight;
|
export as namespace artplayerPluginAmbilight;
|
||||||
+1
-1
@@ -22,5 +22,5 @@ declare function artplayerPluginAsr(option?: AsrPluginOption): (art: Artplayer)
|
|||||||
|
|
||||||
export default artplayerPluginAsr
|
export default artplayerPluginAsr
|
||||||
|
|
||||||
export = artplayerPluginAsr
|
export = artplayerPluginAsr;
|
||||||
export as namespace artplayerPluginAsr;
|
export as namespace artplayerPluginAsr;
|
||||||
+1
-1
@@ -13,5 +13,5 @@ declare const artplayerPluginAutoThumbnail: (option: Option) => (art: Artplayer)
|
|||||||
|
|
||||||
export default artplayerPluginAutoThumbnail
|
export default artplayerPluginAutoThumbnail
|
||||||
|
|
||||||
export = artplayerPluginAutoThumbnail
|
export = artplayerPluginAutoThumbnail;
|
||||||
export as namespace artplayerPluginAutoThumbnail;
|
export as namespace artplayerPluginAutoThumbnail;
|
||||||
+1
-1
@@ -17,5 +17,5 @@ declare const artplayerPluginChapter: (option: Option) => (art: Artplayer) => Re
|
|||||||
|
|
||||||
export default artplayerPluginChapter
|
export default artplayerPluginChapter
|
||||||
|
|
||||||
export = artplayerPluginChapter
|
export = artplayerPluginChapter;
|
||||||
export as namespace artplayerPluginChapter;
|
export as namespace artplayerPluginChapter;
|
||||||
+1
-1
@@ -13,5 +13,5 @@ declare const artplayerPluginChromecast: (option: Option) => (art: Artplayer) =>
|
|||||||
|
|
||||||
export default artplayerPluginChromecast
|
export default artplayerPluginChromecast
|
||||||
|
|
||||||
export = artplayerPluginChromecast
|
export = artplayerPluginChromecast;
|
||||||
export as namespace artplayerPluginChromecast;
|
export as namespace artplayerPluginChromecast;
|
||||||
+1
-1
@@ -21,5 +21,5 @@ declare const artplayerPluginDanmukuMask: (option?: Option) => (art: Artplayer)
|
|||||||
|
|
||||||
export default artplayerPluginDanmukuMask
|
export default artplayerPluginDanmukuMask
|
||||||
|
|
||||||
export = artplayerPluginDanmukuMask
|
export = artplayerPluginDanmukuMask;
|
||||||
export as namespace artplayerPluginDanmukuMask;
|
export as namespace artplayerPluginDanmukuMask;
|
||||||
+1
-1
@@ -255,5 +255,5 @@ declare const artplayerPluginDanmuku: (option: Option) => (art: Artplayer) => Re
|
|||||||
|
|
||||||
export default artplayerPluginDanmuku
|
export default artplayerPluginDanmuku
|
||||||
|
|
||||||
export = artplayerPluginDanmuku
|
export = artplayerPluginDanmuku;
|
||||||
export as namespace artplayerPluginDanmuku;
|
export as namespace artplayerPluginDanmuku;
|
||||||
+1
-1
@@ -13,5 +13,5 @@ declare const artplayerPluginDashControl: (option: { quality?: Config, audio?: C
|
|||||||
|
|
||||||
export default artplayerPluginDashControl
|
export default artplayerPluginDashControl
|
||||||
|
|
||||||
export = artplayerPluginDashControl
|
export = artplayerPluginDashControl;
|
||||||
export as namespace artplayerPluginDashControl;
|
export as namespace artplayerPluginDashControl;
|
||||||
+1
-1
@@ -18,5 +18,5 @@ declare const artplayerPluginDocumentPip: (option: Option) => (art: Artplayer) =
|
|||||||
|
|
||||||
export default artplayerPluginDocumentPip
|
export default artplayerPluginDocumentPip
|
||||||
|
|
||||||
export = artplayerPluginDocumentPip
|
export = artplayerPluginDocumentPip;
|
||||||
export as namespace artplayerPluginDocumentPip;
|
export as namespace artplayerPluginDocumentPip;
|
||||||
+1
-1
@@ -13,5 +13,5 @@ declare const artplayerPluginHlsControl: (option: { quality?: Config, audio?: Co
|
|||||||
|
|
||||||
export default artplayerPluginHlsControl
|
export default artplayerPluginHlsControl
|
||||||
|
|
||||||
export = artplayerPluginHlsControl
|
export = artplayerPluginHlsControl;
|
||||||
export as namespace artplayerPluginHlsControl;
|
export as namespace artplayerPluginHlsControl;
|
||||||
+1
-1
@@ -28,5 +28,5 @@ declare class ArtplayerPluginIframe {
|
|||||||
|
|
||||||
export default ArtplayerPluginIframe
|
export default ArtplayerPluginIframe
|
||||||
|
|
||||||
export = artplayerPluginIframe
|
export = artplayerPluginIframe;
|
||||||
export as namespace artplayerPluginIframe;
|
export as namespace artplayerPluginIframe;
|
||||||
+1
-1
@@ -11,5 +11,5 @@ declare const artplayerPluginAss: (options: Options) => (art: Artplayer) => {
|
|||||||
|
|
||||||
export default artplayerPluginAss
|
export default artplayerPluginAss
|
||||||
|
|
||||||
export = artplayerPluginLibass
|
export = artplayerPluginLibass;
|
||||||
export as namespace artplayerPluginLibass;
|
export as namespace artplayerPluginLibass;
|
||||||
+1
-1
@@ -12,5 +12,5 @@ declare const artplayerPluginMultipleSubtitles: (option: {
|
|||||||
|
|
||||||
export default artplayerPluginMultipleSubtitles
|
export default artplayerPluginMultipleSubtitles
|
||||||
|
|
||||||
export = artplayerPluginMultipleSubtitles
|
export = artplayerPluginMultipleSubtitles;
|
||||||
export as namespace artplayerPluginMultipleSubtitles;
|
export as namespace artplayerPluginMultipleSubtitles;
|
||||||
+1
-1
@@ -29,5 +29,5 @@ declare function artplayerPluginVast(
|
|||||||
|
|
||||||
export default artplayerPluginVast
|
export default artplayerPluginVast
|
||||||
|
|
||||||
export = artplayerPluginVast
|
export = artplayerPluginVast;
|
||||||
export as namespace artplayerPluginVast;
|
export as namespace artplayerPluginVast;
|
||||||
+1
-1
@@ -6,5 +6,5 @@ declare const artplayerPluginVttThumbnail: (option: { vtt?: string, style?: Part
|
|||||||
|
|
||||||
export default artplayerPluginVttThumbnail
|
export default artplayerPluginVttThumbnail
|
||||||
|
|
||||||
export = artplayerPluginVttThumbnail
|
export = artplayerPluginVttThumbnail;
|
||||||
export as namespace artplayerPluginVttThumbnail;
|
export as namespace artplayerPluginVttThumbnail;
|
||||||
+1
-1
@@ -6,5 +6,5 @@ declare const artplayerProxyCanvas: (option?: Option) => (art: Artplayer) => Res
|
|||||||
|
|
||||||
export default artplayerProxyCanvas
|
export default artplayerProxyCanvas
|
||||||
|
|
||||||
export = artplayerProxyCanvas
|
export = artplayerProxyCanvas;
|
||||||
export as namespace artplayerProxyCanvas;
|
export as namespace artplayerProxyCanvas;
|
||||||
+1
-1
@@ -15,5 +15,5 @@ declare const artplayerProxyMediabunny: (option?: Option) => (art: Artplayer) =>
|
|||||||
|
|
||||||
export default artplayerProxyMediabunny
|
export default artplayerProxyMediabunny
|
||||||
|
|
||||||
export = artplayerProxyMediabunny
|
export = artplayerProxyMediabunny;
|
||||||
export as namespace artplayerProxyMediabunny;
|
export as namespace artplayerProxyMediabunny;
|
||||||
Vendored
+33
-1
@@ -126,6 +126,8 @@ export interface Subtitle {
|
|||||||
onVttLoad?: (vtt: string) => string
|
onVttLoad?: (vtt: string) => string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface SettingOption extends Omit<Setting, 'html' | 'icon' | 'tooltip'> {
|
export interface SettingOption extends Omit<Setting, 'html' | 'icon' | 'tooltip'> {
|
||||||
html: string
|
html: string
|
||||||
icon: string | undefined
|
icon: string | undefined
|
||||||
@@ -237,6 +239,10 @@ export interface Quality {
|
|||||||
url: string
|
url: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type AspectRatio = 'default' | '4:3' | '16:9' | (`${number}:${number}` & Record<never, never>)
|
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 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>)
|
export type Flip = 'normal' | 'horizontal' | 'vertical' | (string & Record<never, never>)
|
||||||
@@ -346,6 +352,15 @@ export declare class Player {
|
|||||||
reset(): void
|
reset(): void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type CustomType
|
export type CustomType
|
||||||
= | 'flv'
|
= | 'flv'
|
||||||
| 'm3u8'
|
| 'm3u8'
|
||||||
@@ -754,6 +769,9 @@ declare module 'artplayer/i18n/*' {
|
|||||||
export default lang
|
export default lang
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type Bar = 'loaded' | 'played' | 'hover'
|
export type Bar = 'loaded' | 'played' | 'hover'
|
||||||
|
|
||||||
export interface Events {
|
export interface Events {
|
||||||
@@ -977,6 +995,8 @@ export interface Config {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface Selector {
|
export interface Selector {
|
||||||
/**
|
/**
|
||||||
* Whether the default is selected
|
* Whether the default is selected
|
||||||
@@ -1108,6 +1128,18 @@ export interface ComponentOption {
|
|||||||
onSelect?: (this: Artplayer, selector: Selector, element: HTMLElement, event: Event) => void
|
onSelect?: (this: Artplayer, selector: Selector, element: HTMLElement, event: Event) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
Config,
|
Config,
|
||||||
Events,
|
Events,
|
||||||
@@ -1297,5 +1329,5 @@ export default class Artplayer extends Player {
|
|||||||
} & Record<string, unknown>
|
} & Record<string, unknown>
|
||||||
}
|
}
|
||||||
|
|
||||||
export = Artplayer
|
export = Artplayer;
|
||||||
export as namespace Artplayer;
|
export as namespace Artplayer;
|
||||||
@@ -94,54 +94,7 @@
|
|||||||
|
|
||||||
function localRequire(x) {
|
function localRequire(x) {
|
||||||
var res = localRequire.resolve(x);
|
var res = localRequire.resolve(x);
|
||||||
if (res === false) {
|
return res === false ? {} : newRequire(res);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolve(x) {
|
function resolve(x) {
|
||||||
@@ -616,7 +569,6 @@ function createMediabunnyEngine({ canvas, ctx, events, option = {} }) {
|
|||||||
}
|
}
|
||||||
async function play() {
|
async function play() {
|
||||||
if (!_paused) return;
|
if (!_paused) return;
|
||||||
_ended = false;
|
|
||||||
_paused = false;
|
_paused = false;
|
||||||
await audio.play();
|
await audio.play();
|
||||||
video.start(audio);
|
video.start(audio);
|
||||||
@@ -632,7 +584,6 @@ function createMediabunnyEngine({ canvas, ctx, events, option = {} }) {
|
|||||||
}
|
}
|
||||||
async function seek(time) {
|
async function seek(time) {
|
||||||
const shouldResume = !_paused;
|
const shouldResume = !_paused;
|
||||||
_ended = false;
|
|
||||||
_seeking = true;
|
_seeking = true;
|
||||||
events.emit('seeking');
|
events.emit('seeking');
|
||||||
events.emit('waiting');
|
events.emit('waiting');
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export default function createAudioEngine(events) {
|
|||||||
return
|
return
|
||||||
|
|
||||||
const AudioContext
|
const AudioContext
|
||||||
= window.AudioContext || window.webkitAudioContext
|
= window.AudioContext || window.webkitAudioContext
|
||||||
|
|
||||||
try {
|
try {
|
||||||
audioContext = new AudioContext({ sampleRate })
|
audioContext = new AudioContext({ sampleRate })
|
||||||
@@ -195,8 +195,8 @@ export default function createAudioEngine(events) {
|
|||||||
node.playbackRate.value = _playbackRate
|
node.playbackRate.value = _playbackRate
|
||||||
|
|
||||||
const startAt
|
const startAt
|
||||||
= audioContextStartTime
|
= audioContextStartTime
|
||||||
+ (timestamp - playbackTimeAtStart) / _playbackRate
|
+ (timestamp - playbackTimeAtStart) / _playbackRate
|
||||||
|
|
||||||
const duration = buffer.duration
|
const duration = buffer.duration
|
||||||
const endAt = startAt + duration / _playbackRate
|
const endAt = startAt + duration / _playbackRate
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ export default function createMediabunnyEngine({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const audio = createAudioEngine(events)
|
const audio = createAudioEngine(events)
|
||||||
const video = createVideoEngine({
|
const video = createVideoEngine({
|
||||||
canvas,
|
canvas,
|
||||||
ctx,
|
ctx,
|
||||||
events,
|
events,
|
||||||
timeupdateInterval: option.timeupdateInterval ?? defaults.timeupdateInterval,
|
timeupdateInterval: option.timeupdateInterval ?? defaults.timeupdateInterval,
|
||||||
avSyncTolerance: option.avSyncTolerance ?? defaults.avSyncTolerance,
|
avSyncTolerance: option.avSyncTolerance ?? defaults.avSyncTolerance,
|
||||||
dropLateFrames: option.dropLateFrames ?? defaults.dropLateFrames,
|
dropLateFrames: option.dropLateFrames ?? defaults.dropLateFrames,
|
||||||
poster: option.poster ?? defaults.poster,
|
poster: option.poster ?? defaults.poster,
|
||||||
preflightRange: option.preflightRange ?? false,
|
preflightRange: option.preflightRange ?? false,
|
||||||
})
|
})
|
||||||
|
|
||||||
let _paused = true
|
let _paused = true
|
||||||
let _ended = false
|
let _ended = false
|
||||||
@@ -56,11 +56,11 @@ export default function createMediabunnyEngine({
|
|||||||
|
|
||||||
let timer = null
|
let timer = null
|
||||||
const timeoutPromise
|
const timeoutPromise
|
||||||
= loadTimeout > 0
|
= loadTimeout > 0
|
||||||
? new Promise((_, reject) => {
|
? new Promise((_, reject) => {
|
||||||
timer = setTimeout(() => reject(new Error('Load timeout')), loadTimeout)
|
timer = setTimeout(() => reject(new Error('Load timeout')), loadTimeout)
|
||||||
})
|
})
|
||||||
: null
|
: null
|
||||||
|
|
||||||
const loadTask = (async () => {
|
const loadTask = (async () => {
|
||||||
try {
|
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'
|
import type Artplayer from 'artplayer'
|
||||||
|
|
||||||
interface Option {
|
type Option = {
|
||||||
eventDelay?: number
|
eventDelay?: number
|
||||||
loadTimeout?: number
|
loadTimeout?: number
|
||||||
timeupdateInterval?: number
|
timeupdateInterval?: number
|
||||||
|
|||||||
Reference in new issue
Block a user