Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html><head> |
michael@0 | 3 | <title>gUM Test Page</title> |
michael@0 | 4 | <meta http-equiv="content-type" content="text/html; charset=UTF-8" charset="utf-8"> |
michael@0 | 5 | </head> |
michael@0 | 6 | <body> |
michael@0 | 7 | <script type="application/javascript"> |
michael@0 | 8 | var video_status = false; |
michael@0 | 9 | var video = document.createElement("video"); |
michael@0 | 10 | video.setAttribute("width", 640); |
michael@0 | 11 | video.setAttribute("height", 480); |
michael@0 | 12 | |
michael@0 | 13 | var audio_status = false; |
michael@0 | 14 | var audio = document.createElement("audio"); |
michael@0 | 15 | audio.setAttribute("controls", true); |
michael@0 | 16 | |
michael@0 | 17 | startAudioVideo(); |
michael@0 | 18 | |
michael@0 | 19 | function startAudioVideo() { |
michael@0 | 20 | video_status = true; |
michael@0 | 21 | audio_status = true; |
michael@0 | 22 | startMedia({video:true, audio:true}); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | function stopMedia() { |
michael@0 | 26 | if (video_status) { |
michael@0 | 27 | video.mozSrcObject.stop(); |
michael@0 | 28 | video.mozSrcObject = null; |
michael@0 | 29 | content.removeChild(video); |
michael@0 | 30 | capturing = false; |
michael@0 | 31 | video_status = false; |
michael@0 | 32 | } |
michael@0 | 33 | if (audio_status) { |
michael@0 | 34 | audio.mozSrcObject.stop(); |
michael@0 | 35 | audio.mozSrcObject = null; |
michael@0 | 36 | content.removeChild(audio); |
michael@0 | 37 | audio_status = false; |
michael@0 | 38 | } |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function startMedia(param) { |
michael@0 | 42 | try { |
michael@0 | 43 | window.navigator.mozGetUserMedia(param, function(stream) { |
michael@0 | 44 | message.innerHTML = "<p>Success!</p>"; |
michael@0 | 45 | if (video_status) { |
michael@0 | 46 | content.appendChild(video); |
michael@0 | 47 | video.mozSrcObject = stream; |
michael@0 | 48 | video.play(); |
michael@0 | 49 | } |
michael@0 | 50 | if (audio_status) { |
michael@0 | 51 | content.appendChild(audio); |
michael@0 | 52 | audio.mozSrcObject = stream; |
michael@0 | 53 | audio.play(); |
michael@0 | 54 | } |
michael@0 | 55 | }, function(err) { |
michael@0 | 56 | stopMedia(); |
michael@0 | 57 | }); |
michael@0 | 58 | } catch(e) { |
michael@0 | 59 | stopMedia(); |
michael@0 | 60 | } |
michael@0 | 61 | } |
michael@0 | 62 | </script> |
michael@0 | 63 | </body></html> |