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