Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

What is the event for "the file is ready to play"? #668

Open
HubKing opened this issue Sep 17, 2020 · 3 comments
Open

What is the event for "the file is ready to play"? #668

HubKing opened this issue Sep 17, 2020 · 3 comments

Comments

@HubKing
Copy link

HubKing commented Sep 17, 2020

I have a question (pick one) about Vlc.DotNet.

Generic information

  • Vlc.DotNet version : 3.1.0
  • Vlc.DotNet project used : WinForms
  • libvlc version : x64
  • .net version : 4.8
  • Project language : C#
  • Project build architecture : x64
  • Operating system : Windows 10 x64

Summary

I wanted to open a video file with multiple audio tracks, and set a specific audio track. I tried the "Opening" event, but Audio.Tracks was empty at that point. Then I tried the "Playing" event. Audio.Tracks was filled. But this event is also called when resuming the video from pause. If I use the "Playing" event to set the audio track number, then I would be doing unnecessary things at each pause/resume.

Not just for this case, there could be various other things that I want to do only once when the file is first parsed and ready. What is the solution? Is there another event like "the file is ready to play", or should I keep my own variable to track whether it is the first "Playing" event for this file or not?

  • [ v ] I confirm that my issue doesn't happen in VLC itself.
@jeremyVignelles
Copy link
Collaborator

Parsed?

@HubKing
Copy link
Author

HubKing commented Sep 18, 2020

Using that term, I searched and found this

namespace Vlc.DotNet.Core.Interops.Signatures
{
    public enum EventTypes
      : int
    {
        MediaParsedChanged,

, but I cannot find any "Parsed" event in the VlcControl class. The MediaChanged event does not seem to be it. How can I get the "Parsed" event?

@jeremyVignelles
Copy link
Collaborator

Create a Media instance, call Parse on it, and wait for the ParsedChanged event.

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

No branches or pull requests

2 participants