Class NewFilePlaybackEventArgs
- Namespace
- VisioForge.Core.Types.Events
- Assembly
- VisioForge.Core.dll
Provides data for the new file playback event. This event is raised when a media player starts playing a new file, typically in playlist scenarios.
public class NewFilePlaybackEventArgs : EventArgsInheritance
Inherited Members
Examples
// Example of handling new file playback in a playlist
player.OnNewFileStarted += (sender, e) =>
{
Console.WriteLine($"Now playing: {e.Filename}");
// Update UI with file information
UpdateNowPlayingDisplay(e.Filename);
// Load subtitles if available
LoadSubtitlesForFile(e.Filename);
// Update playlist UI to highlight current item
HighlightPlaylistItem(e.Filename);
};
// Example of tracking playback history
private List<string> playbackHistory = new List<string>();
player.OnNewFileStarted += (sender, e) =>
{
// Add to history
playbackHistory.Add(e.Filename);
// Save last played position for previous file
if (playbackHistory.Count > 1)
{
var previousFile = playbackHistory[playbackHistory.Count - 2];
SavePlaybackPosition(previousFile);
}
// Load saved position for new file
var savedPosition = LoadPlaybackPosition(e.Filename);
if (savedPosition > 0)
{
player.Position_Set_Time(savedPosition);
}
};
Remarks
This event is particularly useful in playlist playback scenarios where you need to be notified when the player transitions from one media file to another. It can be used to update UI elements, load subtitles, or perform any other actions needed when a new file starts playing.
Constructors
NewFilePlaybackEventArgs(string)
Initializes a new instance of the VisioForge.Core.Types.Events.NewFilePlaybackEventArgs class.
public NewFilePlaybackEventArgs(string filename)Parameters
filenamestring-
File name.
Properties
Filename
Gets the full path of the file that has started playing.
public string Filename { get; }