Reputation: 25064
I am using getUserMedia to capture the stream from user camera, so initially the video element source would be null, after successful capture, it set the src
attribute of video, and call play method the element,
html:
...<video></video>...
JS code:
angular.element('video')[0].src = window.URL.createObjectURL(stream);
angular.element('video')[0].play();
I am getting a feeling that this is a bad approach, I want to something like
html:
...<video ng-src="videoObj.src"></video>...
JS code:
videoObj.src = window.URL.createObjectURL(stream);
....
now how do I make the video play automatically when I set videoObj.src
?
Upvotes: 0
Views: 945
Reputation: 326
What about to set autoplay attribute?
<video autoplay="autoplay"></video>
Upvotes: 1