HLS based free player

https://github.com/sampotts/plyr

Codepen source

https://codepen.io/pen?template=oyLKQb

Source code of the displayed player

<!doctype html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="https://unpkg.com/plyr@3/dist/plyr.css"> <title>Dokument bez názvu</title> <script> document.addEventListener('DOMContentLoaded', () => { const source = 'https://livesportradio.com/global/livescore/playlist.m3u8'; const audio = document.querySelector('audio'); const controls = ` <div class="plyr__controls"> <button type="button" class="plyr__control" aria-label="Play, {title}" data-plyr="play"> <svg class="icon--pressed" role="presentation"><use xlink:href="#plyr-pause"></use></svg> <svg class="icon--not-pressed" role="presentation"><use xlink:href="#plyr-play"></use></svg> <span class="label--pressed plyr__tooltip" role="tooltip">Pause</span> <span class="label--not-pressed plyr__tooltip" role="tooltip">Play</span> </button> <button type="button" class="plyr__control" aria-label="Mute" data-plyr="mute"> <svg class="icon--pressed" role="presentation"><use xlink:href="#plyr-muted"></use></svg> <svg class="icon--not-pressed" role="presentation"><use xlink:href="#plyr-volume"></use></svg> <span class="label--pressed plyr__tooltip" role="tooltip">Unmute</span> <span class="label--not-pressed plyr__tooltip" role="tooltip">Mute</span> </button> </div> `; // For more options see: https://github.com/sampotts/plyr/#options // captions.update is required for captions to work with hls.js const player = new Plyr(audio, { controls }); if (!Hls.isSupported()) { audio.src = source; } else { // For more Hls.js options, see https://github.com/dailymotion/hls.js const hls = new Hls(); hls.loadSource(source); hls.attachMedia(audio); window.hls = hls; player.on('languagechange', () => { // Caption support is still flaky. See: https://github.com/sampotts/plyr/issues/994 setTimeout(() => hls.subtitleTrack = player.currentTrack, 50); // Handle changing captions }); } // Expose player so it can be used from the console window.player = player; }); </script> <style> .container { margin: 20px auto; width: 100px; } </style> </head> <body> <div class="container"> <audio crossorigin playsinline ></audio> </div> <!-- Plyr resources and browser polyfills are specified in the pen settings --> <!-- Hls.js 0.9.x and 0.10.x both have critical bugs affecting this demo. Using fixed git hash to when it was working (0.10.0 pre-release), until https://github.com/video-dev/hls.js/issues/1790 has been resolved --> <script src="https://cdn.rawgit.com/video-dev/hls.js/18bb552/dist/hls.min.js"></script> <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,Array.prototype.includes,CustomEvent,Object.entries,Object.values,URL"></script> <script src="https://unpkg.com/plyr@3"></script> </body> </html>