2 changed files with 19 additions and 3 deletions
@ -1,5 +1,21 @@
@@ -1,5 +1,21 @@
|
||||
import { Controller } from "@/stores/player/controllers/types"; |
||||
|
||||
function useBaseController(el: HTMLVideoElement): Controller { |
||||
return {}; |
||||
export function useBaseController(): Controller { |
||||
let el: HTMLVideoElement | undefined; |
||||
|
||||
return { |
||||
registerVideoElement(video) { |
||||
el = video; |
||||
}, |
||||
pause() { |
||||
el?.pause(); |
||||
}, |
||||
play() { |
||||
el?.play(); |
||||
}, |
||||
setVolume(target) { |
||||
if (!el) return; |
||||
el.volume = target; |
||||
}, |
||||
}; |
||||
} |
||||
|
Loading…
Reference in new issue