[Spice-commits] Branch 'stream2' - 2 commits - src/display.js
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Apr 7 09:13:25 UTC 2020
Rebased ref, commits from common ancestor:
commit 68c29a1e0ab1337e105a6a954daea7edd5df1b9c
Author: Jeremy White <jwhite at codeweavers.com>
Date: Tue Dec 31 10:50:32 2019 -0600
Make an attempt to follow the rules on auto play videos.
Browsers have stopped allowing auto play videos. The documented solution
is to mute your video. This patch mutes our videos and also attempts to
start playing if the auto play does not fire.
diff --git a/src/display.js b/src/display.js
index 4941884..f20d6b4 100644
--- a/src/display.js
+++ b/src/display.js
@@ -559,6 +559,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
var v = document.createElement("video");
v.src = window.URL.createObjectURL(media);
+ v.setAttribute('muted', true);
v.setAttribute('autoplay', true);
v.setAttribute('width', m.stream_width);
v.setAttribute('height', m.stream_height);
@@ -1146,6 +1147,10 @@ function handle_append_video_buffer_done(e)
stream.video.currentTime = stream.video.buffered.start(stream.video.buffered.length - 1);
}
+ /* Modern browsers try not to auto play video. */
+ if (this.stream.video.paused && this.stream.video.readyState >= 2)
+ var promise = this.stream.video.play();
+
if (Utils.STREAM_DEBUG > 1)
console.log(stream.video.currentTime + ":id " + stream.id + " updateend " + Utils.dump_media_element(stream.video));
}
commit 2c36a2474b96dc781040d29de726c5b60b318b56
Author: Jeremy White <jwhite at codeweavers.com>
Date: Tue Dec 31 10:52:12 2019 -0600
Allow pointer events to go through our videos.
If a video covers up a substantial portion of the screen,
you can no longer interact with it.
This change allows pointer events to flow through to our canvas.
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/src/display.js b/src/display.js
index cac0715..4941884 100644
--- a/src/display.js
+++ b/src/display.js
@@ -571,7 +571,7 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
top += this.surfaces[m.surface_id].canvas.offsetTop;
}
document.getElementById(this.parent.screen_id).appendChild(v);
- v.setAttribute('style', "position: absolute; top:" + top + "px; left:" + left + "px;");
+ v.setAttribute('style', "pointer-events:none; position: absolute; top:" + top + "px; left:" + left + "px;");
media.addEventListener('sourceopen', handle_video_source_open, false);
media.addEventListener('sourceended', handle_video_source_ended, false);
More information about the Spice-commits
mailing list