mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
refactor(mediabunny): [PKG-MB-08] checkpoint typed entry and compatible media declarations
This commit is contained in:
1 parent
8a2b56e829
commit
5e28dfee95
39 files changed
+3007
-287
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import Artplayer from 'artplayer'
|
||||
import factory from 'artplayer-proxy-mediabunny'
|
||||
|
||||
type Option = Parameters<typeof factory>[0]
|
||||
const art = new Artplayer({ container: '#player', url: 'movie.mp4', proxy: factory() })
|
||||
const replacement: typeof factory = (_option?: Option) => (_art: Artplayer) => document.createElement('canvas')
|
||||
const canvas: ReturnType<ReturnType<typeof factory>> = document.createElement('canvas')
|
||||
factory()
|
||||
factory(undefined)
|
||||
factory({ volume: 0.7, source: new Blob([]), loadTimeout: 1000 })(art)
|
||||
void [replacement, canvas]
|
||||
@@ -0,0 +1,34 @@
|
||||
import Artplayer from 'artplayer'
|
||||
import factory from 'artplayer-proxy-mediabunny'
|
||||
|
||||
const art = new Artplayer({ container: '#player', url: 'movie.mp4', proxy: factory() })
|
||||
type Option = NonNullable<Parameters<typeof factory>[0]>
|
||||
type HistoricalFactory = (option?: Option) => (art: Artplayer) => HTMLCanvasElement
|
||||
const assignOld: HistoricalFactory = factory
|
||||
const assignNew: typeof factory = (_option?: Option) => (_art: Artplayer) => document.createElement('canvas')
|
||||
const initializer: ReturnType<typeof factory> = () => document.createElement('canvas')
|
||||
const canvas: ReturnType<ReturnType<typeof factory>> = document.createElement('canvas')
|
||||
const options: Option = {
|
||||
source: new ReadableStream<Uint8Array>(),
|
||||
loadTimeout: 1000,
|
||||
timeupdateInterval: 250,
|
||||
avSyncTolerance: 0.12,
|
||||
dropLateFrames: false,
|
||||
poster: 'poster.jpg',
|
||||
preflightRange: false,
|
||||
volume: 0.7,
|
||||
muted: false,
|
||||
autoplay: false,
|
||||
loop: false,
|
||||
crossOrigin: 'anonymous',
|
||||
m3u8: {
|
||||
quality: { control: true, setting: true, title: 'Quality', auto: 'Auto', getName: level => `${level.id}/${level.index}/${level.name}/${level.height}/${level.bitrate}` },
|
||||
audio: { control: true, setting: true, title: 'Audio', auto: 'Auto', getName: track => `${track.id}/${track.index}/${track.name}/${track.lang}/${track.language}/${track.bitrate}` },
|
||||
},
|
||||
}
|
||||
factory()
|
||||
factory(undefined)
|
||||
factory(options)(art).getContext('2d')
|
||||
factory({ source: new Blob([]) })
|
||||
factory({ source: 'movie.mp4' })
|
||||
void [assignOld, assignNew, initializer, canvas]
|
||||
Reference in new issue
Block a user