/// <summary> /// Asynchronously plays a stream. /// </summary> /// <param name="uri">The uri of a stream to play.</param> /// <param name="connectionTimeout"></param> /// <exception cref="Win32Exception">Failed to load the FFmpeg facade dll.</exception> /// <exception cref="StreamPlayerException">Failed to play the stream.</exception> /// <param name="transport">RTSP transport protocol.</param> /// <param name="flags">RTSP flags.</param> public void StartPlay(Uri uri, TimeSpan connectionTimeout, RtspTransport transport, RtspFlags flags, FrameDelay framedelay) { if (IsPlaying) { Stop(); } Player.StartPlay(uri.IsFile ? uri.LocalPath : uri.ToString(), connectionTimeout, transport, flags, framedelay); }
/// <summary> /// Asynchronously plays a stream. /// </summary> /// <param name="url">The url of a stream to play.</param> /// <param name="connectionTimeout">The connection timeout.</param> /// <exception cref="StreamPlayerException">Failed to play the stream.</exception> /// <param name="transport">RTSP transport protocol.</param> /// <param name="flags">RTSP flags.</param> internal void StartPlay(String url, TimeSpan connectionTimeout, RtspTransport transport, RtspFlags flags) { if (_startPlayDelegate(url, Convert.ToInt32(connectionTimeout.TotalMilliseconds), Convert.ToInt32(transport), Convert.ToInt32(flags)) != 0) { throw new StreamPlayerException("Failed to play the stream."); } }
/// <summary> /// Constructs a stream. /// </summary> /// <param name="uri">The uri of a stream to play.</param> /// <param name="connectionTimeout">The connection timeout.</param> /// <param name="streamTimeout">The stream timeout.</param> /// <param name="transport">RTSP transport protocol.</param> /// <param name="flags">RTSP flags.</param> public static Stream FromUri(Uri uri, TimeSpan connectionTimeout, TimeSpan streamTimeout, RtspTransport transport, RtspFlags flags) { var type = Load(); var proxy = type.GetMethod("FromUri").Invoke(null, new Object[] { uri, connectionTimeout, streamTimeout, transport, flags }); return(new Stream(proxy)); }