UNPKG

cloudinary-video-player

Version:

Cloudinary Video Player

131 lines (102 loc) 4.37 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Cloudinary Video Player</title> <link href="https://cloudinary-res.cloudinary.com/image/asset/favicon-32x32-2991a47c2caa80211bf2dbf3f29317c8.png" rel="icon" sizes="32x32" type="image/png"> <!-- We're loading scripts & style dynamically for development/testing. Real-world usage would look like this: <link rel="stylesheet" href="https://unpkg.com/cloudinary-video-player/dist/cld-video-player.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/cloudinary-core/2.3.0/cloudinary-core-shrinkwrap.js"></script> <script src="https://unpkg.com/cloudinary-video-player/dist/cld-video-player.min.js"></script> --> <script type="text/javascript" src="./scripts.js"></script> <script type="text/javascript"> window.addEventListener('load', function(){ var cld = cloudinary.Cloudinary.new({ cloud_name: 'demo' }); var source1 = { publicId: 'snow_horses', info: { title: 'Snow Horses', subtitle: 'A movie about snow horses' } }; var source2 = { publicId: 'dirt_bike', info: { title: 'Dirt Bike', subtitle: 'A short video of dirt bikes' } }; var source3 = { publicId: 'marmots', info: { title: 'Marmots' } }; var player = cld.videoPlayer('player',{ playlistWidget: { direction: "horizontal", total: 4 } }); var playlistSources = [source1, source2, source3]; var playlistOptions = { autoAdvance: true, repeat: true, presentUpcoming: 8 }; // Auto advance to next video after 0 seconds, repeat the playlist when final video ends, and present upcoming video 5 seconds before the current video ends. player.playlist(playlistSources, playlistOptions); }, false); </script> </head> <body> <style> .fluid-demo-container { width: 100%; max-width: 1024px; } </style> <div class="container p-4 col-12 col-md-9 col-xl-6"> <nav class="nav mb-2"> <a href="../index.html"><< Back to examples index</a> </nav> <h1>Cloudinary Video Player</h1> <h3 class="mb-4">Playlist</h3> <div class="d-flex flex-column justify-content-start align-items-start"> <video playsinline id="player" controls autoplay class="cld-video-player" width="500" ></video> </div> <p class="mt-4"> <a href="https://cloudinary.com/documentation/video_player_playlists_recommendations#creating_a_playlist">Playlist documentation</a> </p> <h3 class="mt-4">Example Code:</h3> <pre><code class="language-html"> &lt;video id="player" controls autoplay class="cld-video-player" width="500" &gt;&lt;/video&gt; </code></pre> <pre><code class="language-javascript"> var cld = cloudinary.Cloudinary.new({ cloud_name: 'demo' }); var source1 = { publicId: 'snow_horses', info: { title: 'Snow Horses', subtitle: 'A movie about snow horses' } }; var source2 = { publicId: 'dirt_bike', info: { title: 'Dirt Bike', subtitle: 'A short video of dirt bikes' } }; var source3 = { publicId: 'marmots', info: { title: 'Marmots' } }; var player = cld.videoPlayer('player',{ playlistWidget: { direction: "horizontal", total: 4 } }); var playlistSources = [source1, source2, source3]; var playlistOptions = { autoAdvance: true, repeat: true, presentUpcoming: 8 }; // Auto advance to next video after 0 seconds, repeat the playlist when final video ends, and present upcoming video 5 seconds before the current video ends. player.playlist(playlistSources, playlistOptions); </code></pre> </div> <!-- Bootstrap --> <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <!-- highlight.js --> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/solarized-light.min.css"> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script> </body> </html>