0.1.1 • Published 8 months ago
@cameratag/react_player v0.1.1
CameraTag's Video Player
This react component allows you to embed a CameraTag <Player> in your React app.
Initialize A Player
Below is an example of how to load a <Player> in your app.
import Player from "@cameratag/react_player";
export default function App() {
return <Player uuid='a-6793d070-dbac-013b-f57a-529b7d4fe95c' id='myPlayer'/>
}Call Methods / Observe Events
If you want to call methods on the <Player> from our JS API you can pass a function into the onInit prop and the function will be passed a handle to the newly initialized <Player>.
import Player from "@cameratag/react_player";
export default function App() {
// grab a handle for the JS API
function getHandle(myPlayer) {
// you can call then call API methods or observe events
myPlayer.play();
myPlayer.observe("stopped", ()=>{
console.log("Done so soon?");
});
}
return <Player onInit={getHandle} uuid='a-6793d070-dbac-013b-f57a-529b7d4fe95c' id='myPlayer'/>
}