summaryrefslogtreecommitdiffstats
path: root/mobile/android/tests/browser/robocop/robocop_getusermedia.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /mobile/android/tests/browser/robocop/robocop_getusermedia.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'mobile/android/tests/browser/robocop/robocop_getusermedia.html')
-rw-r--r--mobile/android/tests/browser/robocop/robocop_getusermedia.html86
1 files changed, 86 insertions, 0 deletions
diff --git a/mobile/android/tests/browser/robocop/robocop_getusermedia.html b/mobile/android/tests/browser/robocop/robocop_getusermedia.html
new file mode 100644
index 000000000..1ec86d61b
--- /dev/null
+++ b/mobile/android/tests/browser/robocop/robocop_getusermedia.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html><head>
+ <title>gUM Test Page</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" charset="utf-8">
+</head>
+<body>
+ <div id="content"></div>
+ <script type="application/javascript">
+ var video_status = false;
+ var video = document.createElement("video");
+ video.setAttribute("width", 640);
+ video.setAttribute("height", 480);
+
+ var audio_status = false;
+ var audio = document.createElement("audio");
+ audio.setAttribute("controls", true);
+
+ var content = document.getElementById("content");
+ document.title = "gUM Test Page";
+
+ startAudioVideo();
+
+ function startAudioVideo() {
+ video_status = true;
+ audio_status = true;
+ mediaConstraints = {
+ video: {
+ mozMediaSource: "browser",
+ mediaSource: "browser"
+ },
+ audio: true
+ };
+ startMedia(mediaConstraints);
+ }
+
+ function stopMedia() {
+ if (video_status) {
+ video.srcObject.stop();
+ video.srcObject = null;
+ content.removeChild(video);
+ capturing = false;
+ video_status = false;
+ }
+ if (audio_status) {
+ audio.srcObject.stop();
+ audio.srcObject = null;
+ content.removeChild(audio);
+ audio_status = false;
+ }
+ }
+
+ function startMedia(param) {
+ try {
+ window.navigator.mozGetUserMedia(param, function(stream) {
+ if (video_status) {
+ content.appendChild(video);
+ video.srcObject = stream;
+ video.play();
+ }
+ if (audio_status) {
+ content.appendChild(audio);
+ audio.srcObject = stream;
+ audio.play();
+ }
+ var audioTracks = stream.getAudioTracks();
+ var videoTracks = stream.getVideoTracks();
+ document.title = "";
+ if (audioTracks.length > 0) {
+ document.title += "audio";
+ }
+ if (videoTracks.length > 0) {
+ document.title += "video";
+ }
+ document.title += " gumtest";
+ audio.srcObject.stop();
+ video.srcObject.stop();
+ }, function(err) {
+ document.title = "failed gumtest";
+ stopMedia();
+ });
+ } catch(e) {
+ stopMedia();
+ }
+ }
+</script>
+</body></html>