-
-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,659 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>opus-media-recorder Audio-only Example - Record Plugin for Video.js</title> | ||
|
||
<link href="//vjs.zencdn.net/7.10.2/video-js.min.css" rel="stylesheet"> | ||
<link href="//unpkg.com/videojs-wavesurfer/dist/css/videojs.wavesurfer.min.css" rel="stylesheet"> | ||
<link href="//unpkg.com/videojs-record/dist/css/videojs.record.min.css" rel="stylesheet"> | ||
<link href="assets/examples.css" rel="stylesheet"> | ||
|
||
<script src="//vjs.zencdn.net/7.10.2/video.min.js"></script> | ||
<script src="//unpkg.com/webrtc-adapter/out/adapter.js"></script> | ||
<script src="lib/opus-media-recorder/OpusMediaRecorder.umd.js"></script> | ||
<script src="//unpkg.com/wavesurfer.js/dist/wavesurfer.min.js"></script> | ||
<script src="//unpkg.com/wavesurfer.js/dist/plugin/wavesurfer.microphone.min.js"></script> | ||
<script src="//unpkg.com/videojs-wavesurfer/dist/videojs.wavesurfer.min.js"></script> | ||
|
||
<script src="//unpkg.com/videojs-record/dist/videojs.record.min.js"></script> | ||
<script src="//unpkg.com/videojs-record/dist/plugins/videojs.record.opus-media-recorder.min.js"></script> | ||
|
||
<style> | ||
/* change player background color */ | ||
#myAudio { | ||
background-color: #96d6d6; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<audio id="myAudio" class="video-js vjs-default-skin"></audio> | ||
|
||
<script> | ||
// Polyfill MediaRecorder | ||
window.MediaRecorder = OpusMediaRecorder; | ||
|
||
var options = { | ||
controls: true, | ||
bigPlayButton: false, | ||
width: 600, | ||
height: 300, | ||
fluid: false, | ||
plugins: { | ||
wavesurfer: { | ||
backend: 'WebAudio', | ||
waveColor: '#4c4a56', | ||
progressColor: 'black', | ||
debug: true, | ||
cursorWidth: 1, | ||
hideScrollbar: true, | ||
plugins: [ | ||
// enable microphone plugin | ||
WaveSurfer.microphone.create({ | ||
bufferSize: 4096, | ||
numberOfInputChannels: 1, | ||
numberOfOutputChannels: 1, | ||
constraints: { | ||
video: false, | ||
audio: true | ||
} | ||
}) | ||
] | ||
}, | ||
record: { | ||
audio: true, | ||
video: false, | ||
maxLength: 20, | ||
debug: true, | ||
displayMilliseconds: true, | ||
audioEngine: 'opus-media-recorder', | ||
audioWorkerURL: 'lib/opus-media-recorder/encoderWorker.umd.js', | ||
audioWebAssemblyURL: { | ||
OggOpusEncoderWasmPath: 'lib/opus-media-recorder/OggOpusEncoder.wasm', | ||
WebMOpusEncoderWasmPath: 'lib/opus-media-recorder/WebMOpusEncoder.wasm' | ||
} | ||
} | ||
} | ||
}; | ||
var player = videojs('myAudio', options, function() { | ||
// print version information at startup | ||
var msg = 'Using video.js ' + videojs.VERSION + | ||
' with videojs-record ' + videojs.getPluginVersion('record') + | ||
', videojs-wavesurfer ' + videojs.getPluginVersion('wavesurfer') + | ||
' and wavesurfer.js ' + WaveSurfer.VERSION; | ||
videojs.log(msg); | ||
}); | ||
|
||
// error handling | ||
player.on('deviceError', function() { | ||
console.log('device error:', player.deviceErrorCode); | ||
}); | ||
|
||
player.on('error', function(element, error) { | ||
console.error(error); | ||
}); | ||
|
||
// user clicked the record button and started recording | ||
player.on('startRecord', function() { | ||
console.log('started recording!'); | ||
}); | ||
|
||
// user completed recording and stream is available | ||
player.on('finishRecord', function() { | ||
// the blob object contains the recorded data that | ||
// can be downloaded by the user, stored on server etc. | ||
console.log('finished recording: ', player.recordedData); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.