mediacapture-picker.js
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
webshim.register('mediacapture-picker', function($, webshim, window, document, undefined, featureOptions){
"use strict";
function PhotoShooter($dom){
this.$dom = $dom;
this._createDom();
this.requestMedia();
}
PhotoShooter.prototype = {
_createDom: function(){
this.$dom.html('<div class="ws-videocapture-view">' +
'<video class="ws-usermedia ws-inlineusermedia" autoplay=""></video>' +
'<div class="ws-video-overlay"></div>' +
'</div>' +
'<div class="button-row"><button type="button" class="ws-capture-button">take</button>' +
'</div>')
;
},
requestMedia: function(){
var that = this;
navigator.getUserMedia(
{video: {minWidth: 200, audio: false}},
function(stream){
that.stream = stream;
$('video', that.$dom).prop('src', URL.createObjectURL(stream));
},
function(){
}
);
$('video', that.$dom).removeClass('ws-usermedia');
}
};
webshim.mediacapture.showContent = function($fileinput, $button, popover){
var stream = new PhotoShooter(popover.contentElement);
};
});