JSFiddle - React, Tailwind, and code Playground
by dledle2
HTML
<script src='//cdnjs.cloudflare.com/ajax/libs/hls.js/0.7.11/hls.min.js'></script>
<!-- <script src="//cdn.jsdelivr.net/hls.js/latest/hls.min.js"></script> // -->
<video id="video" controls poster="https://static.wixstatic.com/media/4d7ad7_0c64bd651390448fb749a123b09655ec~mv2.jpg"></video>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('http://tvemsnbc-lh.akamaihd.net/i/nbcmsnbc_1@122532/index_796_av-p.m3u8?sd=10&rebase=on');
hls.attachMedia(video);
hls.autoplay=true;
};
</script>
CSS
#video {
width: 500px;
background-color: black;
}
JavaScript
if (location.protocol != 'http:') {
try{location.href = 'http:' + window.location.href.substring(window.location.protocol.length); }catch(e){}}
/* myStrURL= */
/* try{window.open(myStrURL , '' , ''); }catch(e){} */
window.boolWindowOpenedSuccessfullyAlready = false;
function inIframe () {
try {
/* below command will cause a permissions error when using iframes */
/* and will break into the catch part for error handling */
return window.self !== window.top;
} catch (e) {
return true;
}
}
function isURLjsfiddleshowlight () {
if ( document.location.href.toLowerCase().contains('/show/light/') )
{return true;}
else
{return false;}
/* below end bracket: end of function: isURLjsfiddleshowlight*/
}
try{
if (inIframe() === true){
if (window.open(window.location.href)){window.boolWindowOpenedSuccessfullyAlready=true;}
}
/* if (isURLjsfiddleshowlight() != true){window.open(window.location.href); } */
}catch(e){}
/* alert(window.boolWindowOpenedSuccessfullyAlready); */
function myFuncinIframeAndAlsoWindowOpenSameFunction() {
if (typeof window.boolWindowOpenedSuccessfullyAlready == 'undefined')
{ window.boolWindowOpenedSuccessfullyAlready=false; }
console.log(window.boolWindowOpenedSuccessfullyAlready);
if (window.boolWindowOpenedSuccessfullyAlready ===false) {
try {
if(window.self !== window.top){
if (window.open(window.location.href)){window.boolWindowOpenedSuccessfullyAlready=true;}
/* */
}
}catch(e){}
}
console.log(window.boolWindowOpenedSuccessfullyAlready);
/* below end bracket: end of function: myFuncinIframeAndAlsoWindowOpenSameFunction */
}
myFuncinIframeAndAlsoWindowOpenSameFunction();
/* myStrURL=window.location.href; */
/* try{window.open(myStrURL , '' , ''); }catch(e){} */