0.1.2 • Published 6 months ago
@cameratag/microphone v0.1.2
CameraTag's Audio Recorder
This library allows you to embed a CameraTag <microphone> audio recorder in your product.
Initialize A Recorder
'Magically' initialize your recorder using HTML
<microphone
id='myFirstMicrophone'
data-app-id='a-6793d070-dbac-013b-f57a-529b7d4fe95c'>
</microphone>
<script>
CameraTagMicrophone.setup(); // Scan DOM for new <microphone> tags
// if you need to access the newly initialized <:microphone>
// you can get a handle with.
myMicrophone = CameraTagMicrophone.instances["myFistMicrophone"];
</script>Manually initialize your recorder using JS
<div id="load_recorder_here"></div>
<script>
CameraTagMicrophone = require("@cameratag/microphone");
var el = document.getElementById("load_recorder_here");
var myMicrophone = new CameraTagMicrophone();
myMicrophone.init(el {
id: 'myFirstMicrophone'
appUuid: 'a-6793d070-dbac-013b-f57a-529b7d4fe95c',
})
<script>Control The Recorder
You can control your <microphone> with methods from our JS API
After you get a handle on a <microphone> you can call methods on it like so:
myMicrophone.record();Observe The Recorder
You can also observe events fired by the <microphone> and trigger your own code. View our our docs to see the full list of events fired from the <microphone>
myCamera.ovbserve("recordingStarted", function(){
console.log("You are recording!")
});