public async Task TuneActiveTimeShift() { string activeFile = TvClientV2.CurrentSession.VirtualCard.TimeShiftFileName.Substring(19); string activeStream = @"\\HNHPD5\MP Timeshifting\" + activeFile; TVSource = new Uri(activeStream); mediaElement1.Source = TVSource; mediaElement1.Play(); currentSession = TvClientV2.CurrentSession; timeshiftActive = true; }
public async static Task<TimeShiftSession> StartTimeShift(Channel channel) { if (ControlUser.CardId == -1) { ControlUser = new User(System.Environment.MachineName, true); CurrentSession = new TimeShiftSession(); } VirtualCard card; TvResult tvResult; //if (CurrentSession.VirtualCard != null) //await StopTimeShift(); //HAVE TO STOP TIMESHIFT IN ORDER FOR TVSERVER TO DELETE LIVE BUFFER tvResult = RemoteControl.Instance.StartTimeShifting(ref TvClientV2.ControlUser, channel.IdChannel, out card); TvClientV2.ControlUser.CardId = card.Id; TvClientV2.ControlUser.IdChannel = card.IdChannel; TvClientV2.TimeShiftSession timeShiftSession = new TvClientV2.TimeShiftSession() { User = ControlUser, VirtualCard = card, }; CurrentSession = timeShiftSession; return timeShiftSession; }
private async Task tuneChannel(int idChannel) { if (!TvClientV2.IsConnected) System.Windows.MessageBox.Show("TV NOT CONNECTED"); Channel channel = Enumerable.Single<Channel>((IEnumerable<Channel>)TvClientV2.Channels, (Func<Channel, bool>)(chan => chan.SortOrder == idChannel)); //HAVE TO STOP PLAYBACK AND CLOSE MEDIAELEMENT IN ORDER TO FREE LIVE BUFFER FILE FOR UPDATED CHANNEL //mediaElement1.Stop(); //mediaElement1.Close(); //mediaElement1.Source = null; currentSession = await TvClientV2.StartTimeShift(channel); //mediaElement1.Play(); //mediaElement1.Source = TVSource; //mediaElement1.Play(); timeshiftActive = true; }