Esempio n. 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="options"></param>
        public Video(RegionOptions options)
            : base(options.width, options.height, options.top, options.left)
        {
            _filePath = Uri.UnescapeDataString(options.uri).Replace('+', ' ');
            _duration = options.duration;

            _videoPlayer          = new VideoPlayer();
            _videoPlayer.Width    = options.width;
            _videoPlayer.Height   = options.height;
            _videoPlayer.Location = new System.Drawing.Point(0, 0);

            // Should we loop?
            if (options.Dictionary.Get("loop", "0") == "1" && _duration == 0)
            {
                _videoPlayer.SetLooping(true);
            }

            // Should we mute?
            _videoPlayer.SetMute((options.Dictionary.Get("mute", "0") == "1"));

            // Capture any video errors
            _videoPlayer.VideoError += new VideoPlayer.VideoErrored(_videoPlayer_VideoError);

            Controls.Add(_videoPlayer);
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="options"></param>
        public Video(RegionOptions options)
            : base(options.width, options.height, options.top, options.left)
        {
            _options  = options;
            _filePath = Uri.UnescapeDataString(options.uri).Replace('+', ' ');
            _duration = options.duration;

            _videoPlayer = new VideoPlayer();

            // Should this video be full screen?
            if (options.Dictionary.Get("showFullScreen", "0") == "1")
            {
                Width               = options.LayoutSize.Width;
                Height              = options.LayoutSize.Height;
                _videoPlayer.Width  = options.LayoutSize.Width;
                _videoPlayer.Height = options.LayoutSize.Height;
            }
            else
            {
                _videoPlayer.Width  = options.width;
                _videoPlayer.Height = options.height;
            }

            // Assert the location after setting the control size
            _videoPlayer.Location = new System.Drawing.Point(0, 0);

            // Should we loop?
            _videoPlayer.SetLooping((options.Dictionary.Get("loop", "0") == "1" && _duration != 0));

            // Should we mute?
            _videoPlayer.SetMute((options.Dictionary.Get("mute", "0") == "1"));

            // Capture any video errors
            _videoPlayer.VideoError += new VideoPlayer.VideoErrored(_videoPlayer_VideoError);
            _videoPlayer.VideoEnd   += new VideoPlayer.VideoFinished(_videoPlayer_VideoEnd);

            Controls.Add(_videoPlayer);
        }
Esempio n. 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="options"></param>
        public Video(RegionOptions options)
            : base(options.width, options.height, options.top, options.left)
        {
            _filePath = Uri.UnescapeDataString(options.uri).Replace('+',' ');
            _duration = options.duration;

            _videoPlayer = new VideoPlayer();
            _videoPlayer.Width = options.width;
            _videoPlayer.Height = options.height;
            _videoPlayer.Location = new System.Drawing.Point(0, 0);

            // Should we loop?
            _videoPlayer.SetLooping((options.Dictionary.Get("loop", "0") == "1" && _duration != 0));

            // Should we mute?
            _videoPlayer.SetMute((options.Dictionary.Get("mute", "0") == "1"));

            // Capture any video errors
            _videoPlayer.VideoError += new VideoPlayer.VideoErrored(_videoPlayer_VideoError);
            _videoPlayer.VideoEnd += new VideoPlayer.VideoFinished(_videoPlayer_VideoEnd);

            Controls.Add(_videoPlayer);
        }
Esempio n. 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="options"></param>
        public Audio(RegionOptions options)
            : base(options.width, options.height, options.top, options.left)
        {
            _filePath = Uri.UnescapeDataString(options.uri).Replace('+', ' ');
            _duration = options.duration;

            _videoPlayer          = new VideoPlayer();
            _videoPlayer.Width    = 0;
            _videoPlayer.Height   = 0;
            _videoPlayer.Location = new System.Drawing.Point(0, 0);
            _videoPlayer.SetVisible(false);

            // Should we loop?
            _videoPlayer.SetLooping((options.Dictionary.Get("loop", "0") == "1" && _duration != 0));

            // Should we mute?
            _videoPlayer.SetVolume(options.Dictionary.Get("volume", 100));

            // Capture any video errors
            _videoPlayer.VideoError += new VideoPlayer.VideoErrored(_videoPlayer_VideoError);
            _videoPlayer.VideoEnd   += new VideoPlayer.VideoFinished(_videoPlayer_VideoEnd);

            Controls.Add(_videoPlayer);
        }