aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2020-02-25 12:09:29 +0300
committerRblSb <msrblsb@gmail.com>2020-02-25 12:09:29 +0300
commit1cc391ceb0cf5db62e0422390780e79de2597202 (patch)
treeafacd48f0c1f76f1eaf713ad752d96f3437ebd58
parent93410166580465608c370bb36cdc2b953e43b965 (diff)
Hide video controls automatically
-rw-r--r--res/client.js26
-rw-r--r--src/client/Player.hx11
2 files changed, 30 insertions, 7 deletions
diff --git a/res/client.js b/res/client.js
index 13a9107..ebe12b8 100644
--- a/res/client.js
+++ b/res/client.js
@@ -1169,32 +1169,44 @@ client_Player.prototype = {
item.url = this.main.tryLocalIp(item.url);
this.video.src = item.url;
this.video.controls = true;
- this.video.oncanplaythrough = function(e) {
+ var isTouch = 'ontouchstart' in window;
+ if(!isTouch) {
+ haxe_Timer.delay(function() {
+ _gthis.video.controls = false;
+ _gthis.video.onmouseover = function(e) {
+ _gthis.video.controls = true;
+ _gthis.video.onmouseover = null;
+ return _gthis.video.onmousemove = null;
+ };
+ return _gthis.video.onmousemove = _gthis.video.onmouseover;
+ },3000);
+ }
+ this.video.oncanplaythrough = function(e1) {
if(!_gthis.isLoaded) {
_gthis.main.send({ type : "VideoLoaded"});
}
return _gthis.isLoaded = true;
};
- this.video.onseeking = function(e1) {
+ this.video.onseeking = function(e2) {
if(_gthis.skipSetTime) {
_gthis.skipSetTime = false;
return;
}
- if((_gthis.main.personal.group & 2) == 0) {
+ if((_gthis.main.personal.group & 1 << ClientGroup.Leader._hx_index) == 0) {
return;
}
_gthis.main.send({ type : "SetTime", setTime : { time : _gthis.video.currentTime}});
return;
};
- this.video.onpause = function(e2) {
- if((_gthis.main.personal.group & 2) == 0) {
+ this.video.onpause = function(e3) {
+ if((_gthis.main.personal.group & 1 << ClientGroup.Leader._hx_index) == 0) {
return;
}
_gthis.main.send({ type : "Pause", pause : { time : _gthis.video.currentTime}});
return;
};
- this.video.onplay = function(e3) {
- if((_gthis.main.personal.group & 2) == 0) {
+ this.video.onplay = function(e4) {
+ if((_gthis.main.personal.group & 1 << ClientGroup.Leader._hx_index) == 0) {
return;
}
_gthis.main.send({ type : "Play", play : { time : _gthis.video.currentTime}});
diff --git a/src/client/Player.hx b/src/client/Player.hx
index bee9a3c..d8e4cb4 100644
--- a/src/client/Player.hx
+++ b/src/client/Player.hx
@@ -1,5 +1,6 @@
package client;
+import haxe.Timer;
import js.html.Element;
import js.html.VideoElement;
import js.Browser.document;
@@ -29,6 +30,16 @@ class Player {
item.url = main.tryLocalIp(item.url);
video.src = item.url;
video.controls = true;
+ final isTouch = untyped __js__("'ontouchstart' in window");
+ if (!isTouch) Timer.delay(() -> {
+ video.controls = false;
+ video.onmouseover = e -> {
+ video.controls = true;
+ video.onmouseover = null;
+ video.onmousemove = null;
+ }
+ video.onmousemove = video.onmouseover;
+ }, 3000);
video.oncanplaythrough = e -> {
if (!isLoaded) main.send({type: VideoLoaded});
isLoaded = true;
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage