UNPKG

@gobistories/gobi-web-integration

Version:

This library will let you put your Gobi stories on your site.

133 lines (115 loc) 3.37 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Gobi - Web Integration test</title> <script type="text/javascript" src="/dist/run-config.js"></script> <style> .examples { display: flex; flex-wrap: wrap; gap: 1rem; width: 100%; justify-content: center; margin-top: 2rem; } .example { display: flex; flex-direction: column; width: 10rem; justify-content: flex-start; align-items: center; } .example img, .example video { border-radius: 8px; } h5 { width: 80%; text-align: center; font-family: sans-serif; font-size: 12px; } h5 code { font-weight: normal; } img { width: 100%; } video { width: 100%; } </style> <script type="text/javascript" src="../index.js?v=d85e77"></script></head> <body> <h2>Posters, covers and thumbnails</h2> <p> The following are previews of a story using the various media urls provided by the <code>/renders</code> response. </p> <div class="examples"> <div class="example"> <h5>Image Thumbnail <code>thumbnailUrl</code></h5> <img id="thumbnail" src="" /> </div> <div class="example"> <h5>GIF Thumbnail <code>animatedThumbnailUrl</code></h5> <img id="animated-thumbnail" src="" /> </div> <div class="example" id="webm-thumbnail"> <h5>WebM Thumbnail <code>webmThumbnailUrl</code></h5> </div> <div class="example" id="mp4-thumbnail"> <h5>Mp4 Thumbnail <code>mp4ThumbnailUrl</code></h5> </div> </div> <div class="examples"> <div class="example"> <h5>Poster Image <code>posterUrl</code></h5> <img id="poster" src="" /> </div> <div class="example"> <h5>Cover Image <code>coverUrl</code></h5> <img id="cover-image" src="" /> </div> <div class="example" id="webm-cover"> <h5>WebM Cover <code>webmCoverUrl</code></h5> </div> <div class="example" id="mp4-cover"> <h5>Mp4 Cover <code>mp4ThumbnailUrl</code></h5> </div> </div> <script> function setSource(id, url) { document.getElementById(id).src = url; } function addVideo(id, type, url) { if (!url) { return; } const container = document.getElementById(id); const video = document.createElement("video"); video.loop = true; video.autoplay = true; video.muted = true; const source = document.createElement("source"); source.type = "video/" + type; source.src = url; video.appendChild(source); container.appendChild(video); } fetch(runConfig.apiBaseUrl + "/api/v5/renders/demo20").then(async (result) => { const render = await result.json(); setSource("thumbnail", render.thumbnailUrl); setSource("animated-thumbnail", render.animatedThumbnailUrl); setSource("poster", render.posterUrl); setSource("cover-image", render.coverUrl); addVideo("webm-thumbnail", "webm", render.webmThumbnailUrl); addVideo("mp4-thumbnail", "mp4", render.mp4ThumbnailUrl); addVideo("webm-cover", "webm", render.webmCoverUrl); addVideo("mp4-cover", "mp4", render.mp4CoverUrl); }); </script> </body> </html>