<script>
function playerr(){
const video = document.querySelector("video");
const source = video.getElementsByTagName("source")[0].src;
const defaultOptions = {};
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource(source);
// From the m3u8 playlist, hls parses the manifest and returns
// all available video qualities. This is important, in this approach,
// we will have one source on the Plyr player.
hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
// Transform available levels into an array of integers (height values).
const availableQualities = hls.levels.map((l) => l.height)
// Add new qualities to option
defaultOptions.quality = {
default: availableQualities[0],
options: availableQualities,
// this ensures Plyr to use Hls to update quality level
forced: true,
onChange: (e) => updateQuality(e),
}
// Initialize here
const player = new Plyr(video, defaultOptions);
player.on('ready', () => {
const { elements: { wrapper } } = player
const div = document.createElement('div')
div.id = "plyr--logo"
div.innerHTML = `<img width="120" height="15.3833" src="https://i.postimg.cc/vHgRN7hD/nontongptext.png">`
const logoHoverStyle = document.createElement('style')
logoHoverStyle.innerHTML = `
#plyr--logo {
position: absolute;
top: 12px;
right: 12px;
z-index: 2;
}
#plyr--logo > img {
opacity: 0.6;
cursor: pointer;
}
#plyr--logo > img:hover {
opacity: 0.9;
}
`
document.head.appendChild(logoHoverStyle)
wrapper.appendChild(div)
})
});
hls.attachMedia(video);
window.hls = hls;
} else {
const player = new Plyr(video, defaultOptions);
}
function updateQuality(newQuality) {
window.hls.levels.forEach((level, levelIndex) => {
if (level.height === newQuality) {
console.log("Found quality match with " + newQuality);
window.hls.currentLevel = levelIndex;
}
});
}
}
</script>
<script>
function tele() {
fetch(`https://api.telegra.ph/getPage/motogp-commentary-03-03?return_content=true`,{method: 'GET'})
.then((response) => {
return response.json()
})
.then((data) => {
// Work with JSON data here
document.getElementById("vid").src = data.result.content[0].children[0].children[0];
document.getElementById("info").innerHTML = "CUKUP KLIK IKLAN YANG ADA DI NONTONGP jangan lupa matikan ADBLOCK dan VPN";
playerr();
})
.catch((err) => {
// Do something for an error here
})
}
function gp() {
fetch(`https://pro.ip-api.com/json/?fields=66842623&key=uGZgjL0qOTI19n4`,{method: 'GET'})
.then((response) => {
return response.json()
})
.then((data) => {
// Work with JSON data here
if (data.countryCode != "ES"){
tele()
}
else {
document.getElementById("vid").src= ""
}
})
.catch((err) => {
// Do something for an error here
})
}
window.addEventListener('DOMContentLoaded', (event) => {
gp();
//nama();
});
</script>
0 Komentar