Skip to content

Commit

Permalink
Cleaned up EME examples
Browse files Browse the repository at this point in the history
  • Loading branch information
samdutton committed Jan 4, 2017
1 parent 61f03c1 commit e8d636f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 157 deletions.
Binary file removed eme/images/poster.jpg
Binary file not shown.
49 changes: 0 additions & 49 deletions eme/index.html

This file was deleted.

52 changes: 0 additions & 52 deletions eme/scripted.html

This file was deleted.

35 changes: 15 additions & 20 deletions imagecapture/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,26 @@ takePhotoButton.onclick = takePhoto;
videoSelect.onchange = getStream;
zoomInput.oninput = setZoom;

// Get a list of available media input (and output) devices.
// Get a list of available media input (and output) devices
// then get a MediaStream for the currently selected input device
navigator.mediaDevices.enumerateDevices()
.then(blah)
.then(gotDevices)
.catch(error => {console.log('enumerateDevices() error: ', error);})
.then(getStream);

function blah(){
console.log('blah');
// From the list of media devices available, set up the camera source <select>,
// then get a video stream from the default camera source.
function gotDevices(deviceInfos) {
for (var i = 0; i !== deviceInfos.length; ++i) {
var deviceInfo = deviceInfos[i];
console.log('Found media input or output device: ', deviceInfo);
var option = document.createElement('option');
option.value = deviceInfo.deviceId;
if (deviceInfo.kind === 'videoinput') {
option.text = deviceInfo.label || 'Camera ' + (videoSelect.length + 1);
videoSelect.appendChild(option);
}
}
}

// Get a video stream from the currently selected camera source.
Expand All @@ -52,7 +63,6 @@ function getStream() {
}
var videoSource = videoSelect.value;
constraints = {
audio: false,
video: {deviceId: videoSource ? {exact: videoSource} : undefined}
};
navigator.mediaDevices.getUserMedia(constraints)
Expand All @@ -62,21 +72,6 @@ function getStream() {
});
}

// From the list of media devices available, set up the camera source <select>,
// then get a video stream from the default camera source.
function gotDevices(deviceInfos) {
for (var i = 0; i !== deviceInfos.length; ++i) {
var deviceInfo = deviceInfos[i];
console.log('Found media input or output device: ', deviceInfo);
var option = document.createElement('option');
option.value = deviceInfo.deviceId;
if (deviceInfo.kind === 'videoinput') {
option.text = deviceInfo.label || 'Camera ' + (videoSelect.length + 1);
videoSelect.appendChild(option);
}
}
}

// Display the stream from the currently selected camera source, and then
// create an ImageCapture object, using the video from the stream.
function gotStream(stream) {
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ <h1>simpl.info</h1>
<a href="details" title="Details/summary element example">&lt;details&gt; and &lt;summary&gt;</a>
<a href="devicemotion" title="Device Motion example">Device Motion</a>
<a href="deviceorientation" title="Device Orientation example">Device Orientation</a>
<a href="eme/clearkey" title="EME Clear Key example">Encrypted Media Extensions (EME) Clear Key</a>
<a href="eventsource" title="EventSource (Server-Sent Events) example">EventSource (aka Server-Sent Events)</a>
<a href="fetch" title="Fetch API example">Fetch</a>
<a href="localstorage" title="Fieldset example">Fieldset (localStorage example)</a>
Expand Down
36 changes: 0 additions & 36 deletions ssi.html

This file was deleted.

0 comments on commit e8d636f

Please sign in to comment.