-
Notifications
You must be signed in to change notification settings - Fork 104
Player (Open)
Preparing the Player. You select the purpose / usage of the Player with Config.Player.Usage (AVS/Audio/VideoLowLatency) you choose the Min/Max Buffer Duration with Config.Player.MinBufferDuration and Config.Demuxer.BufferDuration.
For more options available check Config.cs, FFmpeg Formats and FFmpeg Protocols
- You call Player.Open() or Player.OpenAsync() and provide a Url (string) or a Custom IO Stream (System.IO.Stream)
- Plugins will process your input and they will provide you their own Playlist Items
- If you set defaultPlaylistItem=false you will have to choose and open one available Playlist Items (Player.Playlist.Items) otherwise Plugins will choose for you
- If you set defaultVideo=false you will have to choose and open one from the streams available (Player.Video.Streams or Playlist.Selected.ExternalVideoStream) otherwise the Plugins will choose for you (currently based on the max resolution of your connected monitors)
- if you set defaultAudio=false you will have to choose and open one from the streams available (Player.Audio.Streams or Playlist.Selected.ExternalAudioStream) otherwise the Plugins will choose for you (currently based on Config.Audio.Languages by priority and based on program that the selected video is to avoid extra bandwidth in case of network stream)
- If you set defaultSubtitles=false you will have to choose and open one from the streams available (Player.Subtitles.Streams or Playlist.Selected.ExternalSubtitlesStream) otherwise the Plugins might search local and/or online (Config.Subtitles.Search Local/Online) / choose for you (currently based on Config.Subtitles.Languages by priority and based on program that the selected video is to avoid extra bandwidth in case of network stream)
- Finally, you will get Event notifications from OpenXCompleted for each open that you have called
- You call Player.OpenAsync(video_file_path) with all the defaults
- Plugins will provide a single Playlist Item with the provided video_file_path
- Player will Open the Playlist Item
- Player will Open the default AudioStream/VideoStream/SubtitlesStream (you can be notified from Player.decoder.OpenXStreamCompleted for each one that actually opened)
- You will be notified by the OpenCompleted event
- You call Player.Open(youtube_url, false, false, false, false) -no defaults-
- You call Player.Open(Player.Playlist.Items[0], false, false, false) -no defaults- to open the first playlist item
- You call Player.Open(Player.Video.Streams[0], false, false) -no defaults- to open the first video stream
- You call Player.Open(Player.Audio.Streams[0], false, false) -no defaults- to open the first audio stream
- You call Player.Open(subtitles_url) to open manually a subtitles url
- Now that you have opened a playlist item and audio/video/subtitles streams you can start playing Player.Play()
A similar example could be with torrent streaming (BitSwarm) plugin while you open a Season torrent with multiple video files. It could choose for you (as it does by default the first from the sorted list) or you could have your own way to choose (so you open with defaultPlaylistItem=false)
Switching between inputs or streams does not require to Pause the Player. It can happened while IsPlaying. When switching has completed, it will resync the inputs / streams and you will be notified with the changes by the OpenXStreamCompleted events
If you switching video streams it is recommended to use the defaultAudio=true to allow it to follow the new VideoStream in case of network streams to avoid additional bandwidth (AudioStream might enables also another VideoStream and you get the bandwidth of 2 videos)
If you Open multiple streams during initial Open (e.g. for Audio/Video/Subtitles streams) at once, disable the resync to avoid multiple seeks and set it only at the last one which should be the video stream.
Open will block when OpenAsync won't. Events will be fired in any case but when you call blocking Open you can get the open results (args) directly. Useful when you want to run a complex open workflow as above to do all the steps in a single thread. From the other hand, OpenAsync calls with defaults have the advantage of thread-safe and fast aborts embedded functionality.