2 changed files with 19 additions and 3 deletions
@ -1,5 +1,21 @@ |
|||||||
import { Controller } from "@/stores/player/controllers/types"; |
import { Controller } from "@/stores/player/controllers/types"; |
||||||
|
|
||||||
function useBaseController(el: HTMLVideoElement): Controller { |
export function useBaseController(): Controller { |
||||||
return {}; |
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