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

Cannot stop and (re-play) a stream, it gets disposed. #662

Open
1 of 4 tasks
cactusjack66 opened this issue Mar 5, 2024 · 1 comment
Open
1 of 4 tasks

Cannot stop and (re-play) a stream, it gets disposed. #662

cactusjack66 opened this issue Mar 5, 2024 · 1 comment

Comments

@cactusjack66
Copy link

Problems when playing, stopping and playing a stream

I have a problem using stop and play on a rtsp stream.

I am initializing an instance of the MediaElement once by doing m_MediaPlayer = new MediaPlayer();
This instance should live the whole application lifetime.

After this, I open the rtsp stream: await m_MediaPlayer.Open(new Uri(rtspAdress));
The media opens, and when I do m_MediaPlayer.Play(); the stream is displayed in the MediaElement.

Now I want to stop the stream with m_MediaPlayer.Stop(); and play it again. After calling play again, the stream is not diplayed anymore. The log says:

Direct Command 'Close' accepted. Perparing execution.
OnStreamReadInterrupt was requested an immediate read exit.
EVENT START: BufferingEnded
EVENT DONE : BufferingEnded
V BLK: 14.388 | CLK: 14.417 | DFT: 29 | IX: 4 | RNG: 48.897% | PQ: 0.0k | TQ: 0.0k
Direct Command 'Close' entered
MediaState changed: + Close
Media closed.
OnStreamReadInterrupt was requested an immediate read exit.
EVENT START: MediaStateChanged
EVENT START: MediaClosed
EVENT DONE : MediaStateChanged
Direct Command 'Close' completed. Result: True
EVENT DONE : MediaClosed
Dispose Entered. Waiting for Command Manager processor to stop.
Dispose is waiting for pending direct commands.
Dispose is closing media.
EVENT START: MediaClosed
Media closed.
EVENT DONE : MediaClosed
Dispose completed.

So why is Stop disposing the media?
When I create a new player before re-playing and open the stream again, it works. But this takes a moment, so I just wat to stop and start again. Is that possible?

Issue Categories

  • Bug
  • Feature Request
  • Question
  • Not sure
@MrBean2016
Copy link
Contributor

Have you tried PauseMedia()?

public ConfiguredTaskAwaitable<bool> Pause() => Task.Run(async () =>

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