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

Open stream at current position #451

Closed
spektor56 opened this issue Mar 28, 2024 · 6 comments
Closed

Open stream at current position #451

spektor56 opened this issue Mar 28, 2024 · 6 comments

Comments

@spektor56
Copy link

Is there any way to open a stream at a predetermined position? Whenever I call Player.OpenAsync(stream) it resets the current position of the stream to the beginning. If i set the position of the stream and flush after i get the first half second of the beginning of the stream first.

@SuRGeoNix
Copy link
Owner

SuRGeoNix commented Mar 28, 2024

  1. Set Config.Player.AutoPlay = false
  2. You should either reset Config.Player.AutoPlay (on OpenCompleted) to true or Listen to Player.SeekCompleted and manually call Player.Play
  3. Listen to Player.OpenCompleted event and perform a Player.Seek

@spektor56
Copy link
Author

unfortunately it still plays the first part of the stream even with "Config.Player.AutoPlay = false"

@SuRGeoNix
Copy link
Owner

I just retested to ensure AutoPlay=false works. Can you provide a log file?

@spektor56
Copy link
Author

Autoplay=false works, but when I set the position of the steam and then call play, the first half second of the beginning of the stream plays before it skips to the current stream position. I'm setting the position on the stream itself since it's a combination of raw hevc streams via ssh, so all I know is the length of the stream in bytes, not how long it is etc. Even with autoplay=false I'm assuming it's still buffering the data to play

@SuRGeoNix
Copy link
Owner

SuRGeoNix commented Mar 30, 2024

I'm not sure yet how you use it, but the proper way and build-in way to seek will flush the packet queue after the seek has been completed and it will decode until the first video frame to present it. Did you check the (trace) logs? Does the demuxer brings old packets after seek?

@spektor56
Copy link
Author

spektor56 commented Apr 2, 2024

rewind

This is an example of what is happening, I added some log output you can see. I can't use the player seek because i dont know the time in ms that i need to jump to, I only know the percentage. Its a raw HEVC stream over SSH so there is no information about current position / length in ms

[16:46:54 DBG] Opening New Stream
[16:46:54 DBG] Seeking to: 0%
[16:46:54 DBG] Stream Opened
[16:46:54 DBG] Seeking to: 63%
[16:46:54 DBG] Position Set to: 63%
[16:46:54 DBG] Calling Play
[16:46:54 DBG] Buffering Started - Current Stream Position:63%
[16:46:54 DBG] Buffering Complete - Current Stream Position:63%
[16:46:55 DBG] Buffering Started - Current Stream Position:63%
[16:46:55 DBG] Buffering Complete - Current Stream Position:63%

I am calling flush before i call play:

flyleafHost1.Player.Flush();
Serilog.Log.Debug("Calling Play");
flyleafHost1.Player.Play();

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

2 participants