Embeding a <player>

Below are instructions on how to embed your player into a webpage.

Embeding with static HTML
Embeding with dynamic (async) HTML
Embeding with JS
Embeding with React

Embedding a <player> with static HTML

First, make sure you have the cameratag.js and cameratag.css files included in the header of your site. The following <script> tag should appear at the bottom of your page's <head> tag

<script src='//www.cameratag.com/v15/js/cameratag.min.js' type='text/javascript'></script>
<link rel='stylesheet' href='//www.cameratag.com/v15/css/cameratag.css'>

Next, create a new <player> somehwere in your <body> like the one below.

<player id='[INSTANCE_ID]' data-app-id='[YOUR_APP_UUID]'></player>

You will need to replace the values denoted by brackets in the above example.

You will replace [YOUR_APP_UUID] with the UUID of the App you would like to use with this <player>. This can be found under the name of your App on any of the App pages on CameraTag.

You will replace [INSTANCE_ID] with a unique id for that instance of the <player>. This will allow you specifically refernce that <player> on the page.

Pleas note: Each player on a page MUST HAVE A UNIQUE INSTANCE ID however multiple players on a page may be attached to the same App.

Adding a <player> with asynchronous HTML

If you want to embed at a player after the page has loaded simply add the <player> element to the DOM as described in the static embed section above then call the CameraTag rescan() method:
CameraTag.scan();
This will rescan the DOM for any uninitialized playerTag products.

How to initialize a player with JS

First, make sure you have the cameratag.js and cameratag.css files included in the header of your site. The following <script> tag should appear at the bottom of your page's <head> tag

<script src='//www.cameratag.com/v15/js/cameratag.min.js' type='text/javascript'></script>
<link rel='stylesheet' href='//www.cameratag.com/v15/css/cameratag.css'>

Then you can initialize a <player> directly with JS by using the CameraTag.init() method. The method takes three parameters:

// If you have the following div:
<div id="playerPlaceHolder"></div>

// The following JS will init a new player and replace your div 
CameraTag.init("playerPlaceHolder", "player", {appUuid: "YOUR_APP_UUID", id: "myPlayer"});

element_id
The ID of an element in the DOM where the <player> should be added. This element will be replaced by the <player>

product_name
The name of the product you wish to instantiate (in this case "player").

options

The required options are appUUID (the UUID of your CameraTag App) and id (A unique identifier for this player instance). Other configurations options can be see on the the configuration docs page.

How to initialize a player with React

<player> tags can be inigialized with the CameraTag react module. See below:

import Player from CameraTag;

//You can the use the component like this:
<Player appUuid="YOUR_APP_UUID" id="myPlayer"/>

There are more attributes that can be used to configure how the player functions. You can see them all on the player configurations docs page.