diff options
| author | RblSb <msrblsb@gmail.com> | 2025-01-12 19:35:56 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2025-01-12 22:35:22 +0300 |
| commit | f84fdc40ba817b6a2d907484b1e1500197ceeafe (patch) | |
| tree | 73a5b81e082d0ac1741c24742db12e6c2bd54249 /src/client/players/Raw.hx | |
| parent | 25b7ecb45d43018235c6a8eb5b4ce833f2dec668 (diff) | |
External audiotrack support
This works as voice over if video also has audio, changing video volume to 0.3.
Also improve autoplay by playing videos muted and unmute on first page click.
There is no mute if you use Firefox and allow autoplay on page (navigator.getAutoplayPolicy check).
Diffstat (limited to 'src/client/players/Raw.hx')
| -rw-r--r-- | src/client/players/Raw.hx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/client/players/Raw.hx b/src/client/players/Raw.hx index 3f69958..5c5b7a4 100644 --- a/src/client/players/Raw.hx +++ b/src/client/players/Raw.hx @@ -67,7 +67,7 @@ class Raw implements IPlayer { callback({ duration: video.duration, title: title, - subs: subs + subs: subs, }); } Utils.prepend(playerEl, video); @@ -115,6 +115,7 @@ class Raw implements IPlayer { } video.onpause = player.onPause; video.onratechange = player.onRateChange; + if (!main.isAutoplayAllowed()) video.muted = true; playerEl.appendChild(video); } if (isHls) initHlsSource(video, url); @@ -185,6 +186,10 @@ class Raw implements IPlayer { video.pause(); } + public function isPaused():Bool { + return video.paused; + } + public function getTime():Float { return video.currentTime; } @@ -200,4 +205,16 @@ class Raw implements IPlayer { public function setPlaybackRate(rate:Float):Void { video.playbackRate = rate; } + + public function getVolume():Float { + return video.volume; + } + + public function setVolume(volume:Float):Void { + video.volume = volume; + } + + public function unmute():Void { + video.muted = false; + } } |
