Product
Other
Question
I’m working on a web player where we handle ad logic during seeking. The current implementation is as follows: when a user seeks from one position to another, we first check and handle the ad logic, then update the seek target. After the initial seek, when the player enters the “isPlaying” state, we immediately try to seek to a new position.
However, sometimes the player gets stuck in a buffering state, even though it shows that it is playing. The issue seems to resolve when the user manually seeks to a different position.
Has anyone encountered a similar issue? What could be the potential reasons for this behavior, and how can we prevent the player from getting stuck in buffering after seeking?
// my code logic
useEffect(()=>{
player.on(PlayerEvent.Playing, (event) => {
if(event.issuer=="ui-seek" && forcedSeekResetRef.current && event.time!=forcedSeekValRef.current){
setTimeout(function () {
player.seek(forcedSeekValRef.current);
},800)
}
})
player.on(PlayerEvent.Seek, (seekEvent) => {
if(!forcedPreRollRef.current){
if(seekEvent.issuer=="ui" && Math.floor(seekEvent.seekTarget)>Math.floor(seekEvent.position) && !forcedSeekResetRef.current){
let adResData=getAdWithResume(adDataRef.current,seekEvent.seekTarget,'fwd',forcedPreRollRef.current,seekEvent.position,forcedSeekedAdsDataRef.current)
if(adResData?.forceSeek){
forcedSeekValRef.current=adResData?.adStartTime;
forcedSeekEndValRef.current=adResData?.adEndTime+1;
forcedResumeValRef.current= Math.floor(adResData?.resumeAt);
forcedSeekResetRef.current=adResData?.resetData;
}
}
}
})
},[])
Thanks