Getting started
- Simple
- Advanced
To load the Caast Library on your website you just need to add this code at the end of your body
tag element
<script type="text/javascript">
// Replace those values by those available in your administration interface
var CAAST_APP_ID = 'YOUR_APP_ID';
(function (c, a, A, s, t, J, S) {
if (!a.getElementById('caast_library')) {
(c[t] = c[t]), (J = a.createElement(A)), (S = a.getElementsByTagName(A)[0]);
J.async = 1;
J.src = s;
J.id = 'caast_library';
S.parentNode.insertBefore(J, S);
}
})(window, document, 'script', 'https://cdn.caast.tv/caast-latest/caast.js?APP_ID=' + CAAST_APP_ID, 'caast');
</script>
With this simple snippet Caast Library is now running on your website, lets have a look on advanced configuration in order to customize the Caast Library.
To implement advanced mode you can call Caast with the following code:
<script type="text/javascript">
window.caastSettings = {
app_id: 'YOUR_APP_ID',
autoboot: true,
product_id: 'YOUR_PRODUCT_ID',
seller_id: 'YOUR_SELLER_ID',
};
(function (c, a, A, s, t, J, S) {
if (!a.getElementById('caast_library')) {
(c[t] = c[t]), (J = a.createElement(A)), (S = a.getElementsByTagName(A)[0]);
J.async = 1;
J.src = s;
J.id = 'caast_library';
S.parentNode.insertBefore(J, S);
}
})(window, document, 'script', 'https://cdn.caast.tv/caast-latest/caast.js', 'caast');
</script>
As you can see you now have a window.caastSettings
object, the available parameters are detailed here:
key name | type | description |
---|---|---|
app_id | string | Your APP_ID, available in your App dashboard |
autoboot | boolean | If set to false, caast will not automatically boot, you will have to manually call the caast.render() method in order to trigger caast flow and display |
product_id | string | If set, Caast will perform a lookup on our APIs if a live or a video is available for this particular product_id |
seller_id | string | If set, Caast will perform a lookup on our APIs if a live or a video is available for this particular seller_id |
Note that product_id
and seller_id
can be cumulated
The autoboot options allows you to have full control about when Caast should start fetching the database and display process see how it works here. If you set the autoboot parameter to false
, you will have to use the caast.render
method. This method is heavily detailed here but the Caast team will help you to setup this process if you need to.