public void RepresentationChange_DestructiveChange_Succeeds(string clipTitle) { RunPlayerTest(clipTitle, async context => { var service = context.Service; var descriptions = service.GetStreamsDescription(StreamType.Audio); var playerObserver = RunningPlayerTask.Observe(context); for (var i = 0; i < descriptions.Count; i++) { var changeOp = new ChangeRepresentationOperation { Index = i, StreamType = StreamType.Audio }; var entry = descriptions[i]; _logger.Info($"Changing to {entry.Id} {entry.StreamType} { entry.Description}"); await changeOp.Execute(context); _logger.Info($"Changing to {entry.Id} {entry.StreamType} { entry.Description} Done"); await playerObserver.VerifyRunning(TimeSpan.FromSeconds(3)); } }); }
public void RepresentationChange_WhileSeeking_Succeeds(string clipTitle) { RunPlayerTest(clipTitle, async context => { var streams = new[] { StreamType.Video, StreamType.Audio }; var service = context.Service; context.SeekTime = null; // Perform random seeks. var defaultTimeout = context.Timeout; foreach (var stream in streams) { var descriptions = service.GetStreamsDescription(stream); for (var i = 0; i < descriptions.Count; i++) { var seekOp = new SeekOperation(); // Wait for seekOp after ChangeRepresentation executes. // Otherwise, position task of SeekOp may timeout as position may not be available // till ChangeRepresentation completes. context.Timeout = TimeSpan.Zero; seekOp.Prepare(context); var seekTask = seekOp.Execute(context); context.Timeout = defaultTimeout; var changeOp = new ChangeRepresentationOperation { Index = i, StreamType = stream }; var changeTask = changeOp.Execute(context); await changeTask.WithCancellation(context.Token); await seekTask.WithTimeout(context.Timeout).WithCancellation(context.Token); } } }); }