Skip to content

Instantly share code, notes, and snippets.

@seemcat
Last active September 14, 2018 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seemcat/8bd607667c428464fcbf49de4d4a3403 to your computer and use it in GitHub Desktop.
Save seemcat/8bd607667c428464fcbf49de4d4a3403 to your computer and use it in GitHub Desktop.
// index.js
ZiggeoApi.token = "APP_TOKEN";
var init = () => {
var element = document.getElementById('recorder-embedding');
ZiggeoApi.V2.Recorder.findByElementPromise(element).success(mount);
}
var mount = (embedding) => {
embedding.on("processed", () => {
fetch("/videoTokens")
.then(res => res.json())
.then(myJson => {
const vidsToDisplay = myJson.reduce((acc, token) => {
acc += `<div class="vid-singles"><ziggeoplayer ziggeo-video="${token}" ziggeo-width=320 ziggeo-height=240 ziggeo-theme="modern" ziggeo-themecolor="red"></ziggeo></div>`;
return acc;
}, '');
const videosElement = document.getElementById('videos');
videosElement.innerHTML = vidsToDisplay;
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment