Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lag in playing VOD stream over ExoPlayer. #52

Closed
kishanio opened this issue Mar 15, 2019 · 8 comments
Closed

Lag in playing VOD stream over ExoPlayer. #52

kishanio opened this issue Mar 15, 2019 · 8 comments

Comments

@kishanio
Copy link

kishanio commented Mar 15, 2019

I have made a tiny wrapper utilising P2P media loader HLS package to be consumed in an Android App. There's 2 things i was wondering if someone can help me cross verify.

  1. In context to HLS.js, setPlayingSegment, is being called on a HLS.JS event i.e. hlsFragChanged.

Likewise in exoplayer i'm tad-bit confused which event would call this. RIght now i'm using onLoadCompleted. Not sure if setPlayingSegment is to be called when frame is requested or responded.

  1. Everything seems to work great except sometimes Media packets (.ts) on successSegment, could take awhile to resolve and resulting in loadError inside ExoPlayer as well as more bufferring than expected. ExoPlayer does try to play it by downgrading the resolution though at somepoint later in sequence ends up hanging up because of sourceError.

One of the solutions i'm tried today was to read chunk list and request for packets ahead of time and keep track of it so when player requests it i can directly resolve it. Though i get this error, Cancel segment request: simultaneous segment requests are not supported.

Just wanted to run it through @mrlika if you have more ideas. Also kudos on library. Lemme know if there's anything i can help with. By now i'm very close to finish reading almost your entire source code to make it work over android.

P.s.: I know i'mma not have a perfect solution (hacky solution ofcourse 😏) just wanted todo a POC that p2p between web+android is possible using webrtc. I think peer5 does same underhood.

@mrlika
Copy link
Member

mrlika commented Mar 15, 2019

Nice try!

In order for the P2P algorithm to work, we have to know what segment is currently playing. This is how we can assign priorities to segments in the segment queue and for example, decide to download a segment over P2P or force HTTP download if it is very close to playhead position.

That is why calling setPlayingSegment in onLoadCompleted is incorrect.

Most likely you have to create separate integration for ExoPlayerand do not use p2p-media-loader-hlsjs but use p2p-media-loader-core directly - call HybridLoader via LoaderInterface

Main responsibility of a player integration is create segments queue, starting from a segment next to currently playing and pass it to load(segments: Segment[], swarmId: string) method.

When the queue changes (play list updated and new segments added to the queue or playhead moved to another segment etc.) you should build new segments queue and pass it to load method again.

Everything else will be handled by HybridLoader. You have to subscribe to its events like SegmentLoaded and SegmentError and pass the loaded segments back to the player.

@jimmywarting
Copy link

This is awesome. I need a p2p-media-loader over ExoPlayer myself. is't open source? any github repo available?

looking for a ios solution as well... even for solution that is not over p2p-media-loader but any WebRTC solution can work as long as it works cross android, ios & web with WebRTC

@mrlika mrlika closed this as completed Jul 19, 2019
@ApparaoMulpuri
Copy link

@kishanio can you throw some lite on how you made the wrapper for the ExoPlayer. I am also trying the same solution, i.e. sharing the packets from HLS to Exo in Android.

@cooliobr
Copy link

cooliobr commented Apr 1, 2020

any news?

@mrlika
Copy link
Member

mrlika commented Apr 1, 2020

Most likely it can be done only be implementing a proxy like it is done in similar paid solutions.

@kishanio
Copy link
Author

yes. i created a proxy.

@vipeweb
Copy link

vipeweb commented Apr 19, 2021

@kishanio você poderia compartilhar sua solução?
acredito que seria um avanço importante essa integração do android nativo

@cooliobr
Copy link

cooliobr commented Apr 19, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants