public PlayVideoAsync ( Media video, bool enableAutoPitch ) : Task | ||
video | Media | |
enableAutoPitch | bool | |
return | Task |
public async Task PlayVideoAsync(Media video, bool enableAutoPitch) {
this.CurrentVideo = video;
this.IsAutoPitchEnabled = enableAutoPitch;
timerGetPositionEnabled = false;
position = 0;
lastStartTime = DateTime.Now;
if (player == null)
Show();
timerGetPositionEnabled = false;
await player.OpenFileAsync(MediaFileName);
// Ensures timerGetPositionEnabled gets re-activated even if play failed, after 5 seconds.
timerPlayTimeout.Stop();
timerPlayTimeout.Start();
}
public async Task OpenMediaAsync(Media item) { this.Item = item; TitleText.Text = Item.Title; TitleText.ToolTip = Item.Title; PositionText.Text = ""; playerBusiness = new WmpPlayerBusiness(Player); playerBusiness.PositionChanged += playerBusiness_PositionChanged; playerBusiness.Show(); await playerBusiness.PlayVideoAsync(Item, false); }