mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
fix(core): [CORE-24] preserve source playback intent and explicit pauses
This commit is contained in:
1 parent
b5e96664ee
commit
0218196df9
22 files changed
+12895
-36
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import type { PauseHost } from '../media/hosts'
|
||||
import type { PlaybackMethods } from '../media/types'
|
||||
import { requestSourcePlayback } from '../source/operation'
|
||||
import { def } from '../utils'
|
||||
|
||||
export default function pauseMix<Media extends Pick<PlaybackMethods, 'pause'>>(art: PauseHost<Media>): asserts art is PauseHost<Media> & { pause: () => ReturnType<Media['pause']> } {
|
||||
@@ -11,6 +12,7 @@ export default function pauseMix<Media extends Pick<PlaybackMethods, 'pause'>>(a
|
||||
|
||||
def(art, 'pause', {
|
||||
value() {
|
||||
requestSourcePlayback(art, false)
|
||||
const result = $video.pause()
|
||||
notice.show = i18n.get('Pause')
|
||||
art.emit('pause')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { PlayHost } from '../media/hosts'
|
||||
import type { PlaybackMethods } from '../media/types'
|
||||
import { captureSource } from '../source/operation'
|
||||
import { captureSourcePlayback, requestSourcePlayback } from '../source/operation'
|
||||
import { def } from '../utils'
|
||||
|
||||
export default function playMix<Media extends Pick<PlaybackMethods, 'play'>>(art: PlayHost<Media>): asserts art is PlayHost<Media> & { play: () => Promise<Awaited<ReturnType<Media['play']>>> } {
|
||||
@@ -14,7 +14,8 @@ export default function playMix<Media extends Pick<PlaybackMethods, 'play'>>(art
|
||||
|
||||
def(art, 'play', {
|
||||
async value() {
|
||||
const active = captureSource(art)
|
||||
requestSourcePlayback(art, true)
|
||||
const active = captureSourcePlayback(art)
|
||||
const result = await $video.play()
|
||||
if (!active())
|
||||
return result
|
||||
|
||||
Reference in new issue
Block a user