Esempio n. 1
0
        /// <summary>
        ///     Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plug-in supported file on the Internet.
        /// </summary>
        /// <param name="url">
        ///     URL of the file to stream. Should begin with "http://" or "https://" or "ftp://", or another add-on
        ///     supported protocol. The URL can be followed by custom HTTP request headers to be sent to the server; the URL and
        ///     each header should be terminated with a carriage return and line feed ("\r\n").
        /// </param>
        /// <param name="configs">Configures of <see cref="AudioNetworkStream" />. </param>
        /// <param name="offset">
        ///     File position to start streaming from. This is ignored by some servers, specifically when the
        ///     length is unknown/undefined.
        /// </param>
        /// <param name="saveStream">Save network stream to local .NET stream.</param>
        public AudioNetworkStream(String url, StreamCreateUrlConfig configs, int offset, Stream saveStream)
        {
            configs |= StreamCreateUrlConfig.Unicode;

            _saveStream = saveStream;

            try
            {
                using (var urlHandle = InteropHelper.StringToPtr(url))
                {
                    Handle =
                        AudioStreamModule.StreamCreateUrlFunction.CheckResult(
                            AudioStreamModule.StreamCreateUrlFunction.Delegate(urlHandle.Handle,
                                                                               offset, configs, OnDownloadProcessing, IntPtr.Zero));
                }
            }
            catch (Exception)
            {
                _saveStream = null;
                throw;
            }
        }
        /// <summary>
        ///     Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plug-in supported file on the Internet.
        /// </summary>
        /// <param name="url">
        ///     URL of the file to stream. Should begin with "http://" or "https://" or "ftp://", or another add-on
        ///     supported protocol. The URL can be followed by custom HTTP request headers to be sent to the server; the URL and
        ///     each header should be terminated with a carriage return and line feed ("\r\n").
        /// </param>
        /// <param name="configs">Configures of <see cref="AudioNetworkStream" />. </param>
        /// <param name="offset">
        ///     File position to start streaming from. This is ignored by some servers, specifically when the
        ///     length is unknown/undefined.
        /// </param>
        /// <param name="saveStream">Save network stream to local .NET stream.</param>
        public AudioNetworkStream(String url, StreamCreateUrlConfig configs, int offset, Stream saveStream)
        {
            configs |= StreamCreateUrlConfig.Unicode;
            
            _saveStream = saveStream;

            try
            {
                using (var urlHandle = InteropHelper.StringToPtr(url))
                {
                    Handle =
                        AudioStreamModule.StreamCreateUrlFunction.CheckResult(
                            AudioStreamModule.StreamCreateUrlFunction.Delegate(urlHandle.Handle,
                                offset, configs, OnDownloadProcessing, IntPtr.Zero));
                }
            }
            catch (Exception)
            {
                _saveStream = null;
                throw;
            }
        }
Esempio n. 3
0
 /// <summary>
 ///     Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plug-in supported file on the Internet.
 /// </summary>
 /// <param name="url">
 ///     URL of the file to stream. Should begin with "http://" or "https://" or "ftp://", or another add-on
 ///     supported protocol. The URL can be followed by custom HTTP request headers to be sent to the server; the URL and
 ///     each header should be terminated with a carriage return and line feed ("\r\n").
 /// </param>
 /// <param name="configs">Configures of <see cref="AudioNetworkStream" />. </param>
 /// <param name="saveStream">Save network stream to local .NET stream.</param>
 public AudioNetworkStream(String url, StreamCreateUrlConfig configs, Stream saveStream)
     : this(url, configs, 0, saveStream)
 {
 }
Esempio n. 4
0
 /// <summary>
 ///     Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plug-in supported file on the Internet.
 /// </summary>
 /// <param name="url">
 ///     URL of the file to stream. Should begin with "http://" or "https://" or "ftp://", or another add-on
 ///     supported protocol. The URL can be followed by custom HTTP request headers to be sent to the server; the URL and
 ///     each header should be terminated with a carriage return and line feed ("\r\n").
 /// </param>
 /// <param name="configs">Configures of <see cref="AudioNetworkStream" />. </param>
 /// <param name="offset">
 ///     File position to start streaming from. This is ignored by some servers, specifically when the
 ///     length is unknown/undefined.
 /// </param>
 public AudioNetworkStream(String url, StreamCreateUrlConfig configs, int offset) : this(url, configs, 0, null)
 {
 }
Esempio n. 5
0
 /// <summary>
 ///     Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plug-in supported file on the Internet.
 /// </summary>
 /// <param name="url">
 ///     URL of the file to stream. Should begin with "http://" or "https://" or "ftp://", or another add-on
 ///     supported protocol. The URL can be followed by custom HTTP request headers to be sent to the server; the URL and
 ///     each header should be terminated with a carriage return and line feed ("\r\n").
 /// </param>
 /// <param name="configs">Configures of <see cref="AudioNetworkStream" />. </param>
 public AudioNetworkStream(String url, StreamCreateUrlConfig configs) : this(url, configs, 0)
 {
 }
 /// <summary>
 ///     Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plug-in supported file on the Internet.
 /// </summary>
 /// <param name="url">
 ///     URL of the file to stream. Should begin with "http://" or "https://" or "ftp://", or another add-on
 ///     supported protocol. The URL can be followed by custom HTTP request headers to be sent to the server; the URL and
 ///     each header should be terminated with a carriage return and line feed ("\r\n").
 /// </param>
 /// <param name="configs">Configures of <see cref="AudioNetworkStream" />. </param>
 /// <param name="saveStream">Save network stream to local .NET stream.</param>
 public AudioNetworkStream(String url, StreamCreateUrlConfig configs, Stream saveStream)
     : this(url, configs, 0, saveStream)
 {
 }
 /// <summary>
 ///     Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plug-in supported file on the Internet.
 /// </summary>
 /// <param name="url">
 ///     URL of the file to stream. Should begin with "http://" or "https://" or "ftp://", or another add-on
 ///     supported protocol. The URL can be followed by custom HTTP request headers to be sent to the server; the URL and
 ///     each header should be terminated with a carriage return and line feed ("\r\n").
 /// </param>
 /// <param name="configs">Configures of <see cref="AudioNetworkStream" />. </param>
 /// <param name="offset">
 ///     File position to start streaming from. This is ignored by some servers, specifically when the
 ///     length is unknown/undefined.
 /// </param>
 public AudioNetworkStream(String url, StreamCreateUrlConfig configs, int offset) : this(url, configs, 0, null)
 {
 }
 /// <summary>
 ///     Creates a sample stream from an MP3, MP2, MP1, OGG, WAV, AIFF or plug-in supported file on the Internet.
 /// </summary>
 /// <param name="url">
 ///     URL of the file to stream. Should begin with "http://" or "https://" or "ftp://", or another add-on
 ///     supported protocol. The URL can be followed by custom HTTP request headers to be sent to the server; the URL and
 ///     each header should be terminated with a carriage return and line feed ("\r\n").
 /// </param>
 /// <param name="configs">Configures of <see cref="AudioNetworkStream" />. </param>
 public AudioNetworkStream(String url, StreamCreateUrlConfig configs) : this(url, configs, 0)
 {
 }