Exemplo n.º 1
0
        /// <summary>
        /// Get stream uri with specified configurations
        /// </summary>
        /// <param name="profile"></param>
        /// <param name="videoSourceConfig">Video source configuration</param>
        /// <param name="videoEncoderConfig">Video encoder configuration</param>
        /// <param name="audioSourceConfig">Audio source configuration</param>
        /// <param name="audioEncoderConfig">Audio encoder configuration</param>
        /// <param name="protocol"></param>
        public void GetMediaUri(
            Media.Profile profile,
            Media.VideoSourceConfiguration videoSourceConfig,
            Media.VideoEncoderConfiguration videoEncoderConfig,
            Media.AudioSourceConfiguration audioSourceConfig,
            Media.AudioEncoderConfiguration audioEncoderConfig,
            Media.TransportProtocol protocol)
        {
            if ((videoEncoderConfig == null) || (videoSourceConfig == null))
            {
                throw new ArgumentNullException();
            }
            string address = View.MediaAddress;

            _mediaClientWorking = true;
            InitializeMediaClient(address);
            _mediaClient.GetMediaUri(profile, videoSourceConfig, videoEncoderConfig, audioSourceConfig, audioEncoderConfig, protocol);
        }
Exemplo n.º 2
0
 private void SetAudioConfiguration(
     Media.AudioEncoderConfiguration config,
     Media.AudioEncoderConfigurationOption options)
 {
     config.Encoding = options.Encoding;
     if (cmbAudioBitrate.SelectedItem != null)
     {
         config.Bitrate = (int)cmbAudioBitrate.SelectedItem;
     }
     else if ((options.BitrateList != null) && (options.BitrateList.Length > 0))
     {
         config.Bitrate = options.BitrateList[0];
     }
     if ((options.SampleRateList != null) && (options.SampleRateList.Length > 0))
     {
         config.SampleRate = options.SampleRateList[0];
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Handles media uri received event
 /// </summary>
 protected void OnMediaUriReceived(Media.MediaUri uri, Media.VideoEncoderConfiguration encoder, Media.AudioEncoderConfiguration audio)
 {
     View.ShowVideo(uri, encoder, audio);
 }
Exemplo n.º 4
0
        public void ShowVideo(Media.MediaUri uri, Media.VideoEncoderConfiguration encoder, Media.AudioEncoderConfiguration audio)
        {
            try
            {
                _videoWindow = new VideoContainer();
                DeviceEnvironment environment    = ContextController.GetDeviceEnvironment();
                int messageTimeout               = environment.Timeouts.Message;
                Media.TransportProtocol protocol = GetTransportProtocol();
                VideoUtils.AdjustVideo(
                    _videoWindow,
                    environment.Credentials.UserName,
                    environment.Credentials.Password,
                    messageTimeout,
                    protocol,
                    Media.StreamType.RTPUnicast,
                    uri,
                    encoder);
                _videoWindow.KEEPALIVE = true;
                _videoWindow.OpenWindow(audio != null);

                Invoke(new Action(() => { btnGetStreams.Text = "Stop Video"; }));
            }
            catch
            {
                _videoWindow = null;
                throw;
            }
        }