Closed jihadkhan closed 10 months ago
You also need to handle headers(Cookie,Host)...to in Web
Boss do you have code for html web or PHP website? I tried lots of ways but I filed.
here is my code: can you check my code please .. if there have any issue can you fix for me? please boss..
<div class="container mt-5">
<h1>Toffee Channels</h1>
<div id="my-video" class="mt-5"></div>
<div id="channelGrid" class="row"></div>
</div>
<script src="//jwpsrv.com/library/O4mPlqeTEeK_viIACpYGxA.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
async function fetchHeadersAndCookies() {
try {
const response = await fetch('https://raw.githubusercontent.com/Jeshan-akand/Toffee-Channels-Link-Headers/main/toffee_channel_data.json');
const data = await response.json();
return data;
} catch (error) {
console.error('Error fetching headers and cookies:', error);
return {};
}
}
async function displayChannels(channels) {
const channelGrid = document.getElementById('channelGrid');
channels.forEach(channel => {
const channelItem = document.createElement('div');
channelItem.className = 'col-3';
const channelLogo = document.createElement('img');
channelLogo.src = channel.logo;
channelLogo.alt = channel.name + ' Logo';
channelLogo.className = 'channel-logo';
channelItem.appendChild(channelLogo);
const channelLink = document.createElement('a');
channelLink.href = '#';
channelLink.textContent = channel.name;
channelLink.addEventListener('click', async function(event) {
event.preventDefault();
const videoLink = channel.link;
const { headers, cookie } = await fetchHeadersAndCookies();
playVideo(videoLink, headers, cookie);
});
channelItem.appendChild(document.createElement('br'));
channelItem.appendChild(channelLink);
channelGrid.appendChild(channelItem);
});
}
function playVideo(videoLink, headers, cookie, logo) {
jwplayer('my-video').setup({
file: videoLink,
width: '100%',
height: 450,
autostart: false,
image: logo,
primary: 'html5',
hlshtml: true,
skin: {
name: 'roundster',
active: '#FF0000',
inactive: '#CCCCCC',
background: '#FFFFFF'
},
headers: {
...headers,
'Host': 'bldcmprod-cdn.toffeelive.com',
'Cookie': cookie // Set the retrieved cookies
}
});
}
fetch('https://raw.githubusercontent.com/Jeshan-akand/Toffee-Channels-Link-Headers/main/toffee_channel_data.json')
.then(response => response.json())
.then(data => displayChannels(data.channels))
.catch(error => console.error('Error fetching data:', error));
});
</script>
I tried this. But not play channel.. I am use jwplayer..
Here is demo: proyojon.heavensbd.com/pp
Check it out.. Tell me what then error
I use vpn.. Same.. Not work