Widget Development playground
The following sample video contains code examples showcasing methods, property types, and usage scenarios in the widget development environment.
Playground Video
Defined Properties for Playground


HTML Code
-
<div class='c-{{uid}}'><div class='col'><span>uid (Unique Identifier)</span><span>{{uid}}</span></div><span>Text</span><span>{{text}}</span></div><span>Color</span><span class='color'>{{color}}</span></div><span>Image</span><img src='{{image}}' width='100' height='100' /><span>Video</span><video class='video' controls nodownload><source src='{{video}}' /></video><span>Text List</span><ul> {{#each textList}} <li>{{this}}</li> {{/each}} </ul><span>Image List</span><div class='image-list'> {{#each imageList}} <img src='{{this}}'/> {{/each}} </div><span>Select Type</span><span>{{this}}</span>
CSS Code
- .c-{{uid}}{ width: 100%; height: 100%; background: #FFF; padding: 1rem; overflow-y: scroll; display: flex; justify-content: space-between; }
- .c-{{uid}} .col{ width: 50%; }
- .c-{{uid}} .col > div{ display: flex; flex-direction: column; margin-bottom: .75rem; }
- .c-{{uid}} .col > div span:first-child{ font-weight: bold; }
- .c-{{uid}} .color{ color: {{color}}; }
- .c-{{uid}} .video{ width: 300px; }
- .c-{{uid}} .image-list img{ width: 64px; height: 64px; margin-right: 10px; }
- .c-{{uid}} button{ width: 200px; }
Javascript Code
- // Unique named variable declaration: var foo_{{uid}} = 'bar'; console.log('Foo: ', foo_{{uid}});
- // Unique named function declaration: function testFn_{{uid}}(){}
- // Set Variable: $('.c-{{uid}} .score-variable-30').click(function() { c8PlayerApi.setVariable('score', 30); });
- // Set/Get Variable: $('.c-{{uid}} .score-variable-add-10').click(function() { var prevState = c8PlayerApi.getVariable('score'); c8PlayerApi.setVariable('score', prevState + 10); });
- // Set Variable: $('.c-{{uid}} .license-variable-enterprise').click(function() { c8PlayerApi.setVariable('license', 'Enterprise'); });
- // Widget Props: $('.c-{{uid}} .widget-props').click(function() { console.log(c8PlayerApi.getWidgetProps()); });
- // Play Video: $('.c-{{uid}} .play').click(function() { c8PlayerApi.play(); });
- // Pause Video: $('.c-{{uid}} .pause').click(function() { c8PlayerApi.pause(); });
- // Check Paused: $('.c-{{uid}} .paused').click(function() { console.log('Paused: ', c8PlayerApi.paused()); });
- // Set Current Time: $('.c-{{uid}} .set-current-time').click(function() { c8PlayerApi.currentTime(12); });
- // Hide Controls: $('.c-{{uid}} .hide-player-controls').click(function() { c8PlayerApi.hideControls(); });
- // Show Controls: $('.c-{{uid}} .show-player-controls').click(function() { c8PlayerApi.showControls(); });
- // Set Volume: $('.c-{{uid}} .set-volume').click(function() { c8PlayerApi.volume(0.5); });
- // Mute Volume: $('.c-{{uid}} .mute-volume').click(function() { c8PlayerApi.volume(0); });
- // Subtitles: $('.c-{{uid}} .subtitles').click(function() { console.log(c8PlayerApi.subtitles()); });
- // Set Subtitle: $('.c-{{uid}} .set-sub-en').click(function() { c8PlayerApi.subtitle('en'); });
- // Launch Fullscreen: $('.c-{{uid}} .launch-fs').click(function() { c8PlayerApi.launchFullscreen(); });
- // Set Quality Level: $('.c-{{uid}} .set-quality-level-360p').click(function() { c8PlayerApi.qualityLevel(2); c8PlayerApi.play(); });