videojs-record
Advanced tools
Comparing version 0.9.1 to 0.9.2
{ | ||
"name": "videojs-record", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"homepage": "https://github.com/collab-project/videojs-record", | ||
@@ -13,2 +13,3 @@ "description": "A video.js plugin for recording audio/video/image files.", | ||
"videojs", | ||
"videojs-plugin", | ||
"player", | ||
@@ -33,4 +34,4 @@ "record", | ||
"video.js": ">=4.11.0 < 5.0.0", | ||
"wavesurfer.js": ">=1.0.23", | ||
"videojs-wavesurfer": ">=0.9.6", | ||
"wavesurfer.js": ">=1.0.44", | ||
"videojs-wavesurfer": ">=0.9.9", | ||
"recordrtc": "git://github.com/muaz-khan/RecordRTC.git", | ||
@@ -37,0 +38,0 @@ "libvorbis.js": ">=0.5.1" |
@@ -70,3 +70,3 @@ 'use strict'; | ||
cwd: 'dist/css', | ||
src: ['*.css'], | ||
src: ['*.css', '!*.min.css'], | ||
dest: 'dist/css', | ||
@@ -73,0 +73,0 @@ ext: '.record.min.css' |
{ | ||
"name": "videojs-record", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "A video.js plugin for recording audio/video/image files.", | ||
@@ -22,2 +22,3 @@ "main": "src/js/videojs.record.js", | ||
"videojs", | ||
"videojs-plugin", | ||
"player", | ||
@@ -34,4 +35,4 @@ "record", | ||
"video.js": ">=4.11.0 < 5.0.0", | ||
"wavesurfer.js": ">=1.0.23", | ||
"videojs-wavesurfer": ">=0.9.6", | ||
"wavesurfer.js": ">=1.0.44", | ||
"videojs-wavesurfer": ">=0.9.9", | ||
"recordrtc": ">=5.0.8", | ||
@@ -38,0 +39,0 @@ "libvorbis.js": ">=0.5.1" |
@@ -175,2 +175,3 @@ Video.js Record | ||
| `stopDevice` | Stop the recording and the active audio and/or video device(s). | | ||
| `getDevice` | Start the audio and/or video device(s). | | ||
@@ -177,0 +178,0 @@ Events |
@@ -371,2 +371,12 @@ (function(window, videojs) { | ||
{ | ||
// define device callbacks once | ||
if (this.deviceReadyCallback === undefined) | ||
{ | ||
this.deviceReadyCallback = this.onDeviceReady.bind(this); | ||
} | ||
if (this.deviceErrorCallback === undefined) | ||
{ | ||
this.deviceErrorCallback = this.onDeviceError.bind(this); | ||
} | ||
// ask the browser to give us access to media device and get a | ||
@@ -382,9 +392,23 @@ // stream reference in the callback function | ||
}; | ||
// remove existing mic listeners | ||
this.surfer.microphone.un('deviceReady', | ||
this.deviceReadyCallback); | ||
this.surfer.microphone.un('deviceError', | ||
this.deviceErrorCallback); | ||
// setup new mic listeners | ||
this.surfer.microphone.on('deviceReady', | ||
this.onDeviceReady.bind(this)); | ||
this.deviceReadyCallback); | ||
this.surfer.microphone.on('deviceError', | ||
this.onDeviceError.bind(this)); | ||
this.deviceErrorCallback); | ||
// disable existing playback events | ||
this.surfer.setupPlaybackEvents(false); | ||
// (re)set surfer liveMode | ||
this.surfer.liveMode = true; | ||
this.surfer.microphone.paused = false; | ||
// open browser device selection dialog | ||
this.player().play(); | ||
this.surfer.microphone.start(); | ||
break; | ||
@@ -453,2 +477,9 @@ | ||
// reset time (e.g. when stopDevice was used) | ||
this.setDuration(this.maxLength); | ||
this.setCurrentTime(0); | ||
// hide play/pause control (e.g. when stopDevice was used) | ||
this.player().controlBar.playToggle.hide(); | ||
// hide live display indicator | ||
@@ -520,3 +551,8 @@ this.player().controlBar.liveDisplay.hide(); | ||
// show camera button | ||
// setup UI for retrying snapshot (e.g. when stopDevice was | ||
// used) | ||
this.retrySnapshot(); | ||
// reset and show camera button | ||
this.player().cameraButton.onStop(); | ||
this.player().cameraButton.show(); | ||
@@ -577,2 +613,3 @@ } | ||
// start/resume live audio visualization | ||
this.surfer.microphone.paused = false; | ||
this.surfer.liveMode = true; | ||
@@ -663,19 +700,48 @@ this.player().play(); | ||
{ | ||
// stop recording | ||
if (this.isRecording()) | ||
{ | ||
// stop stream once recorded data is available, | ||
// otherwise it'll break recording | ||
this.one('finishRecord', this.stopStream); | ||
// stop recording | ||
this.stop(); | ||
} | ||
else | ||
{ | ||
// stop stream now, since there's no recorded data | ||
// being available | ||
this.stopStream(); | ||
} | ||
}, | ||
/** | ||
* Stop stream and device. | ||
*/ | ||
stopStream: function() | ||
{ | ||
// stop stream and device | ||
if (this.stream) | ||
{ | ||
// use MediaStream.stop in browsers other than Chrome for now | ||
// This will be deprecated in Firefox 44 (see | ||
// https://www.fxsitecompat.com/en-US/docs/2015/mediastream-stop-has-been-deprecated/ | ||
// and https://bugzilla.mozilla.org/show_bug.cgi?id=1103188#c106) | ||
if (!this.isChrome()) | ||
{ | ||
this.stream.stop(); | ||
if (this.getRecordType() === this.AUDIO_ONLY) | ||
{ | ||
// make the microphone plugin stop it's device | ||
this.surfer.microphone.stopDevice(); | ||
} | ||
else | ||
{ | ||
// stop MediaStream | ||
this.stream.stop(); | ||
} | ||
} | ||
else | ||
{ | ||
// use MediaStreamTrack in Chrome instead of stream.stop() | ||
// (deprecated since Chrome 45) | ||
// use MediaStreamTrack.stop() in Chrome instead of | ||
// MediaStream.stop() (deprecated since Chrome 45) | ||
// https://developers.google.com/web/updates/2015/07/mediastream-deprecations | ||
@@ -686,4 +752,4 @@ var track; | ||
case this.AUDIO_ONLY: | ||
track = this.stream.getAudioTracks()[0]; | ||
track.stop(); | ||
// make the microphone plugin stop it's device | ||
this.surfer.microphone.stopDevice(); | ||
break; | ||
@@ -707,3 +773,2 @@ | ||
} | ||
this._deviceActive = false; | ||
@@ -1052,2 +1117,16 @@ } | ||
/** | ||
* Reset UI for retrying a snapshot image. | ||
*/ | ||
retrySnapshot: function() | ||
{ | ||
this._processing = false; | ||
// retry: hide the snapshot | ||
this.player().recordCanvas.hide(); | ||
// show preview video | ||
this.player().el().firstChild.style.display = 'block'; | ||
}, | ||
/** | ||
* Capture frame from camera and copy it to canvas. | ||
@@ -1326,10 +1405,4 @@ */ | ||
// retry | ||
recorder._processing = false; | ||
recorder.retrySnapshot(); | ||
// retry: hide the snapshot | ||
this.player().recordCanvas.hide(); | ||
// show preview video | ||
this.player().el().firstChild.style.display = 'block'; | ||
// reset camera button | ||
@@ -1336,0 +1409,0 @@ this.onStop(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
208812
1972
329
Updatedvideojs-wavesurfer@>=0.9.9
Updatedwavesurfer.js@>=1.0.44