-
Notifications
You must be signed in to change notification settings - Fork 6k
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
added seeking capability for mpeg-ts #1274
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
I really don't buy that this is worth doing. If the media is under your control and you want to allow seeking, you should really use a more appropriate container format. If the media isn't under your control then it's a little more debatable, but I'm not sure that this is a priority for us; it's unclear what the actual use case is where a user is trying to play their own MPEG-TS stream, or whether we want to go out of our way to support it. If I were to guess, I think this kind of use case would make up a tiny fraction of total ExoPlayer use. |
I have control on the media, but I'm working on a live streaming case where I could benefit a lot from mpegts, and I don't want to add much overhead by integrating dash or hls, and as you said this case might make up a tiny fraction of exoplayer powerful use. |
What benefits do you obtain from using mpegts, exactly? |
like starting playback from the middle of the stream without the need of some previous packets, which I guess none of the other container formats supports it unless it's segmented as in dash. |
But you can't actually start playback efficiently from a specified position in middle of the stream, since MPEG-TS isn't efficiently seekable. The exception to this rule would be if you have some server-side magic where you can specify the start position using a query parameter in the request, or similar, but given this pull request I'm guessing that's not the case for your setup. DASH, SmoothStreaming and HLS all solve exactly this problem by segmenting the media into chunks and providing manifests that index the chunks in a seekable way. Moving to one of these (preferably DASH) is the correct way to achieve what you're trying to do. What are the benefits of your mpegts solution v.s. moving to DASH, or is it just a matter of implementation complexity / having to do some work? |
sure I can't start exactly from a specific position, but the precision error is tolerable, and no there's no query in my case, it's just like plug and play. |
Fair enough. This isn't something we'll be supporting though. In general, if you want seeking, you should use a streaming technology that's designed to support it, as opposed to using an unsuitable technology and then papering over the cracks in the client players. |
no problem. I guess keeping TsExtractor simple is better but I just wanted to share it so that developers who might be in great need of using mpegts to know that seeking could be implemented and they could benefit from this code. |
As you know mpegts doesn't have a structure for seeking, but one could be built using PCR value, and it appeared that VLC uses it for seeking while playing local mpegts files. Seeking here could only be achieved using seekTo() function and not with the mediacontroller because you still need the duration of the stream, but you can still build up your own mediacontroller that suits your application and use seeking accordingly.