unserver-unify
Version:
40 lines (39 loc) • 1.24 kB
JavaScript
;
angular.module('bamboo').controller('VideoRecordCtrl', function($scope,$sce,$timeout, $uibModalInstance) {
var _self = this;
$scope.uploadRecordingVideo = function() {
var blob=window.audioVideoRecorder.getBlob();
blob.name=(new Date()).getTime().toString()+".webm";
blob.lastModifiedDate = new Date();
blob.duration=document.getElementById('videoplayback').duration;
// console.log(blob);
$uibModalInstance.close({
result: true,
file: blob,
});
}
this.getRecordVideo = function() {
shootVideo(function(stream) {
window.audioVideoRecorder = window.RecordRTC(stream, {
type: 'video'
});
window.audioVideoRecorder.startRecording();
// return callback(stream);
$timeout(function() {
$scope.stopflag=true;
}, 10);
});
}
this.stopRecording = function() {
$timeout(function(){
window.audioVideoRecorder.stopRecording(function(url) {
$timeout(function(){
$scope.playbacksrc=$sce.trustAsResourceUrl(encodeURI(url));
$scope.playback=true;
$scope.readyForUpload=true;
},10);
});
}
,1500)
}
});