aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/players/Raw.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2020-04-23 22:48:37 +0300
committerRblSb <msrblsb@gmail.com>2020-04-24 05:29:48 +0300
commit177057877733c33aadbb11b5884fe2c4a3e13de5 (patch)
tree50035a705fa21f333f66485fe724d5c52e7fc5d5 /src/client/players/Raw.hx
parent3e1f20569d467160dfe578bd80393a528dc60db7 (diff)
Fix youtube bg autoplay
Diffstat (limited to 'src/client/players/Raw.hx')
-rw-r--r--src/client/players/Raw.hx17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/client/players/Raw.hx b/src/client/players/Raw.hx
index c3c96d4..e3c2ed1 100644
--- a/src/client/players/Raw.hx
+++ b/src/client/players/Raw.hx
@@ -10,10 +10,10 @@ import Types.VideoItem;
class Raw implements IPlayer {
- static var controlsHider:Timer;
final main:Main;
final player:Player;
final playerEl:Element = ge("#ytapiplayer");
+ var controlsHider:Timer;
var playAllowed = true;
var video:VideoElement;
@@ -22,6 +22,10 @@ class Raw implements IPlayer {
this.player = player;
}
+ public function isSupportedLink(url:String):Bool {
+ return true;
+ }
+
public function getVideoData(url:String, callback:(data:VideoData)->Void):Void {
var title = url.substr(url.lastIndexOf('/') + 1);
final matchName = ~/^(.+)\./;
@@ -45,18 +49,21 @@ class Raw implements IPlayer {
}
public function loadVideo(item:VideoItem):Void {
+ final url = main.tryLocalIp(item.url);
+ if (video != null) {
+ video.src = url;
+ return;
+ }
video = document.createVideoElement();
video.id = "videoplayer";
- final url = main.tryLocalIp(item.url);
video.src = url;
video.controls = true;
- final isTouch = untyped __js__("'ontouchstart' in window");
if (controlsHider != null) controlsHider.stop();
- if (!isTouch) controlsHider = Timer.delay(() -> {
+ if (!Utils.isTouch()) controlsHider = Timer.delay(() -> {
video.controls = false;
}, 3000);
video.onmousemove = e -> {
- controlsHider.stop();
+ if (controlsHider != null) controlsHider.stop();
video.controls = true;
video.onmousemove = null;
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage