You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
IPTVNator doesn't play MPEG-TS stream, only M3U8/HLS, but TS is a major used format for live channels.
Describe the solution you'd like
Add MPEG.JS to demux MPEG-TS and make it playable.
Additional context
So, I started to make an example in JS/Electron to got a functional HTML5 player with MPEG.JS, and this is how I did to detect stream type after the xtream-code redirect on the /live/ endpoint. I'm sure there is a better way, but that's an idea.
consturl=`${SERVER_URL}/live/${userData.username}/${PASSWORD}/${stream.stream_id}.ts`;$.ajax({url: url,type: "GET",processData: false,xhrFields: {onprogress: function(e){constresponse=e.currentTarget.response;if(!response)return;constencoder=newTextEncoder();constencodedData=encoder.encode(response);this.abort();if(encodedData[0]===35&&encodedData[1]===69&&encodedData[2]===88&&encodedData[3]===84&&encodedData[4]===77){playM3U8(url);}elseif(encodedData[0]===71&&encodedData[1]===64&&encodedData[2]===17){playM2TS(url);}elseif(encodedData[4]===102&&encodedData[5]===116&&encodedData[6]===121||encodedData[0]===239&&encodedData[1]===191&&encodedData[2]===189){playMP4(url);}else{console.error("Unsupported stream type.");}}}})functionplayM2TS(url){if(mpegts.getFeatureList().mseLivePlayback){// Get the video elementconstvideoEl=document.getElementById("videoplayer");// Ensure the video element existsif(!videoEl||!(videoElinstanceofHTMLMediaElement)){console.error("Error: Video element not found or invalid.");}else{// Create the playerconstplayer=mpegts.createPlayer({type: 'mpegts',isLive: true,url: url});// Attach player to the video elementplayer.attachMediaElement(videoEl);// Load and start playbackplayer.load();// Wait for the video element to be ready before calling playvideoEl.addEventListener('canplay',()=>{player.play();console.log("Playback started successfully.");});// Error handlingplayer.on(mpegts.Events.ERROR,(type,details)=>{console.error("MPEG-TS Player Error:",type,details);});}}else{console.error("MPEG-TS playback is not supported in this browser.");}}functionplayM3U8(url){constvideo=document.getElementById('videoplayer');if(Hls.isSupported()){consthls=newHls();hls.on(Hls.Events.MANIFEST_PARSED,function(event,data){video.play();});hls.loadSource(url);hls.attachMedia(video);}elseif(video.canPlayType('application/vnd.apple.mpegurl')){video.src=url;video.play();}else{alert("HLS not supported in this browser.");}}functionplayMP4(url){constvideo=document.getElementById('videoplayer');video.src=url;video.play();video.onended=()=>{playMP4(url);}}
I didn't tried to implement this in IPTVNator.
Have a good day, and merry christmas!
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
IPTVNator doesn't play MPEG-TS stream, only M3U8/HLS, but TS is a major used format for live channels.
Describe the solution you'd like
Add MPEG.JS to demux MPEG-TS and make it playable.
Additional context
So, I started to make an example in JS/Electron to got a functional HTML5 player with MPEG.JS, and this is how I did to detect stream type after the xtream-code redirect on the /live/ endpoint. I'm sure there is a better way, but that's an idea.
I didn't tried to implement this in IPTVNator.
Have a good day, and merry christmas!
The text was updated successfully, but these errors were encountered: