JSFiddle - React, Tailwind, and code Playground

try_msnbc_v01 - another m3u8 -Videojs Example

by dledle2

HTML

<link rel="stylesheet" href="https://vjs.zencdn.net/5.4/video-js.css">
<script src="https://vjs.zencdn.net/5.4/video.js"></script>
<script src="https://videojs.github.io/videojs-contrib-hls/node_modules/videojs-contrib-hls/dist/videojs.hls.min.js"></script>
<video id=example-video width=400 height=300 class="video-js vjs-default-skin" controls>
  <source  src="http://tvemsnbc-lh.akamaihd.net/i/nbcmsnbc_1@122532/master.m3u8?sd=10&rebase=on"
     type="application/x-mpegURL">
</video>
<!--
https://s3-us-west-2.amazonaws.com/hg-video-out/Karolyi,_Tracy_34MQ5_about_me_videod737bccd1ac88a5251ef887734a2f0ab21114f331a25ab7abd9a1e4e46a39f6d/hls_d737bccd1ac88a5251ef887734a2f0ab21114f331a25ab7abd9a1e4e46a39f6d.m3u8

   // -->

JavaScript

if (location.protocol != 'http:') {
  
try{location.href = 'http:' + window.location.href.substring(window.location.protocol.length);    }catch(e){}

var myStrURL='http:' + window.location.href.substring(window.location.protocol.length);
console.log(myStrURL);
myStrURL=myStrURL.replace('/light','');
/* potention case-sensitive issue if i copy/paste to other websites */
console.log(myStrURL);

try{window.open(myStrURL , '' , '');    }catch(e){}
}
else
{
  /* xxx; */


var player = videojs('example-video');

player.play();
}void(0);