Skip to content

Commit

Permalink
fix player error occurred message
Browse files Browse the repository at this point in the history
  • Loading branch information
lKinderBueno committed Nov 5, 2023
1 parent 3100995 commit 61e7e5a
Show file tree
Hide file tree
Showing 8 changed files with 192 additions and 134 deletions.
36 changes: 19 additions & 17 deletions src/components/Live/MainLive.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,31 @@ const MainLive = () => {
const [showPopup, setShowPopup] = useState(false);

useEffect(()=>{
setBlurBackground(((isNaN(category) || category === undefined) || history.location.pathname.includes("menu")) ? {filter:"blur(.5rem)", pointerEvents: "none"} : {});

if(category !== undefined){
loadPlaylist("live",category).then(chs => {
const fun = async() => {
setBlurBackground(((isNaN(category) || category === undefined) || history.location.pathname.includes("menu")) ? {filter:"blur(.5rem)", pointerEvents: "none"} : {});

if(category != undefined && category != 0){
let chs = await loadPlaylist("live",category)
chs = chs || [];
if(category==="fav")
chs = chs.filter(x=> DB.findOne("live",x.stream_id,true))
dispatch(setPlaylist(chs));
if(chs.length === 0)
setShowPopup(1)
})
}else if(resetMemory("live")){
loadGroup("live").then(gps => {
if(!gps || gps.length===0){
history.replace("/")
return;
}
gps.unshift({category_name : "Only favorites", category_id:"fav"})
setGroup(gps[1].category_id)
dispatch(setGroupList(gps));
history.replace("/live/category/"+gps[1].category_id+"/")
})
}else history.replace("/live/category/");
}else if(resetMemory("live")){
await loadGroup("live").then(gps => {
if(!gps || gps.length===0){
history.replace("/")
return;
}
gps.unshift({category_name : "Only favorites", category_id:"fav"})
setGroup(gps[1].category_id)
dispatch(setGroupList(gps));
history.replace("/live/category/"+gps[1].category_id+"/")
})
}else history.replace("/live/category/");
}
fun()
},[dispatch,category])

useEffect(() => {
Expand Down
6 changes: 4 additions & 2 deletions src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ const Login = ({url}) => {
<>
<Container style={blur}>
<Box onKeyDown={remoteController} onSubmit={login}>
<h2>Welcome to {window.playername}</h2>
<h5>Write your credentials to continue.</h5>
{false && (<h2>Welcome to {window.playername}</h2>)}
<h2 className=''><img src="/img/banner_w.png" alt="" className="d-inline-block" style={{maxWidth: "30vw", maxHeight:"18vh"}}/></h2>

<h5>Write your credentials to continue</h5>
<br/>
{!window.dns &&
([
Expand Down
21 changes: 18 additions & 3 deletions src/components/Player/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,24 @@ const Player = () => {
url={url}
pip={pip}
controls={false}
onError={()=> setError(true)}
onBufferEnd={()=>setIsLoading(false)}
onBuffer={()=>setIsLoading(true)}
onProgress={(state)=>{
setError(false)
}}
onPlay={()=>{
setError(false)
}}
onError={(error, data)=> {
setError(true)
setIsLoading(false)
}}
onBufferEnd={()=>{
setError(false)
setIsLoading(false)
}}
onBuffer={()=>{
setIsLoading(true);
setError(false)
}}
/>
{ isLoading === true && (<Spin>
<Loading color={"var(--second-color);"}>
Expand Down
5 changes: 3 additions & 2 deletions src/components/Vod/MainVod.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,18 @@ const MainVod = () => {
setIsLoading(true);

setRefresh(0)
if (reset === true) {
if (reset === true || cat.length === 0) {
await loadGroup(playingMode).then(gps => {
if (!gps || gps.length === 0) {
history.replace("/")
return;
}
gps.unshift({category_id:"fav", favorite:1, category_name: "Only favorites"},{category_id:"toend", history: 1, category_name:"Continue to watch"})
dispatch(setGroupList(gps || []));
cat = gps
})
}
loadPlaylist(playingMode, category || "ALL").then(chs => {
await loadPlaylist(playingMode, category || "ALL").then(chs => {
if(category && isNaN(category)){
chs = chs.filter(s=> {
const f = DB.findOne(playingMode, playingMode === "series" ? s.series_id : s.stream_id, category === "fav")
Expand Down
3 changes: 1 addition & 2 deletions src/other/Player-github/player-github.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default function ReactNetflixPlayer({
onErrorVideo = false,
onNextClick = false,
onClickItemListReproduction = false,
onCrossClick = () => {},
startPosition = 0,

playlistTitle = "Playlist",
Expand Down Expand Up @@ -551,7 +550,7 @@ export default function ReactNetflixPlayer({
<h1>{title}</h1>
<h2>{subTitle}</h2>
</div>
<FiX onClick={onCrossClick} />
<FiX onClick={backButton} />
</header>
)}

Expand Down
36 changes: 21 additions & 15 deletions src/other/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,43 @@ export async function get(url, timeout = 1) {
return Axios.get(url).catch(err => err);
}

export async function post(url, params = {}, local) {
export async function post(url, params = {}, local, useProxy) {
if (!dns)
return null;

let uri = url

if (local === true && !window.location.origin.match(/iptveditor\.com|localhost/)) {
return Axios.post(url, qs.stringify(params)).catch(err => err)
return Axios.post(uri, qs.stringify(params)).catch(err => err)
}

if (isIptveditor === false) {
url += "?";
uri += "?";
for (const key in params) {
url += key + "=" + encodeURIComponent(params[key]) + "&";
uri += key + "=" + encodeURIComponent(params[key]) + "&";
}
}

if (proxyRequired === true && isIptveditor === true)
url = "/proxy.php?url=" + encodeURIComponent(dns);
else if (proxyRequired === true && isIptveditor === false)
url = "/proxy.php?url=" + encodeURIComponent(dns + url);
if ((proxyRequired || useProxy) === true && isIptveditor === true)
uri = "/proxy.php?url=" + encodeURIComponent(dns);
else if ((proxyRequired || useProxy) === true && isIptveditor === false)
uri = "/proxy.php?url=" + encodeURIComponent(dns + uri);
else if (isIptveditor === false)
url = dns + url;
else url = dns;
uri = dns + uri;
else uri = dns;

return isIptveditor === true ?
Axios.post(url, qs.stringify(params)) :
Axios.get(url, {
return isIptveditor === true && !(proxyRequired || useProxy)?
Axios.post(uri, qs.stringify(params)) :
Axios.get(uri, {
headers: {
'User-Agent': 'Mozilla/6.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.55 Safari/537.36 Edge/86.0.622.28'
},
timeout: 25000
}).catch(err => err);
}).catch(err => {
if(proxyRequired === false && !useProxy && !err.response)
return post(url, params, local, true)
return err
});

}

Expand All @@ -55,7 +61,7 @@ export function setDns(data) {
else if (window.location.protocol === 'https:' && !data.includes("https"))
data = data.replace("http", "https");

isIptveditor = !!data.match(/iptveditor\.com|xtream-ie|localhost|192\.168\.178\.71\:3100/)
isIptveditor = !!data.match(/iptveditor\.com|xtream-ie|opop\.pro|localhost|192\.168\.178\.71\:3100/)

if (window.isDebug === 1)
data = window.dns;
Expand Down
45 changes: 22 additions & 23 deletions src/other/epg-database.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,31 +93,30 @@ export async function downloadEpgDataFromCategories(channels) {
if (toDownload.length === 0)
return;
else {
await loadEpgArray(toDownload, limit).then(result => {
toDownload.forEach(id => {
let data = result[[id]]
if (data && data.length > 0) {
data = convertEpgListing(data);
const dataset = epgMap.has(id) ? epgMap.get(id) : { days: {}, data: [] }
mergeDay(dataset, data, limit);
epgMap.set(id, dataset)
} else {
if (epgMap.has(id)) {
if (!epgMap.get(id)){

}
if (!epgMap.get(id).days)
epgMap.get(id).days = {}
epgMap.get(id).days[limit] = false;
} else if (limit === 1)
epgMap.set(id, false);
else {
let obj = { days: {}, data: [] };
obj.days[limit] = false;
epgMap.set(id, obj);
const result = await loadEpgArray(toDownload, limit)
toDownload.forEach(id => {
let data = result[[id]]
if (data && data.length > 0) {
data = convertEpgListing(data);
const dataset = epgMap.has(id) ? epgMap.get(id) : { days: {}, data: [] }
mergeDay(dataset, data, limit);
epgMap.set(id, dataset)
} else {
if (epgMap.has(id)) {
if (!epgMap.get(id)){

}
if (!epgMap.get(id).days)
epgMap.get(id).days = {}
epgMap.get(id).days[limit] = false;
} else if (limit === 1)
epgMap.set(id, false);
else {
let obj = { days: {}, data: [] };
obj.days[limit] = false;
epgMap.set(id, obj);
}
})
}
})

}
Expand Down
Loading

0 comments on commit 61e7e5a

Please sign in to comment.