public FlashMoviePlayerControl()
		{
			InitializeComponent();
			Dock = DockStyle.Fill;

			// FlashManagerの初期化
			flashManager = new FlashMoviePlayerManager(axShockwaveFlash);

			// Flashウィンドウをフックする
			FlashNativeWindow flash = new FlashNativeWindow(axShockwaveFlash.Handle);
			flash.MouseDownEvent += (sender, e) =>
			{
				mouseDownEvent(this, e);
				Focus();
			};
			flash.MouseUpEvent += (sender, e) => mouseUpEvent(this, e);
			flash.MouseMoveEvent += (sender, e) => mouseMoveEvent(this, e);
			flash.DoubleClickEvent += (sender, e) => doubleClickEvent(this, e);
			flash.KeyDownEvent += (sender, e) => keyDownEvent(this, e);
		}
Exemplo n.º 2
0
        public FlashMoviePlayerControl(PecaPlayerControl parent)
        {
            try
            {
                InitializeComponent();
            }
            catch (COMException)
            {
                MessageBox.Show("Flash Playerがインストールされていません。\nInternet ExplorerからFlash Playerをインストールする必要があります。",
                                "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            Dock = DockStyle.Fill;

            // FlashManagerの初期化
            flashManager              = new FlashMoviePlayerManager(axShockwaveFlash);
            flashManager.Initialized += (sender, args) =>
            {
                flashManager.EnableGpu(PlayerSettings.Gpu);
                flashManager.EnableRtmp(PlayerSettings.Rtmp);
                flashManager.SetBufferTime(PlayerSettings.BufferTime);
                flashManager.SetBufferTimeMax(PlayerSettings.BufferTimeMax);
            };
            // ステート変更イベント
            flashManager.OpenStateChange += (sender, args) =>
            {
                if (isFirstMediaOpen)
                {
                    var width  = ((IMoviePlayer)this).ImageWidth;
                    var height = ((IMoviePlayer)this).ImageHeight;
                    axShockwaveFlash.Width  = width;
                    axShockwaveFlash.Height = height;
                    movieStart(this, new EventArgs());
                    isFirstMediaOpen = false;
                }

                // 動画切替時に、ミュートが解除されるための対応
                ((IMoviePlayer)this).Mute = isMute;
                if (!isMute)
                {
                    flashManager.ChangeVolume(volume);
                }
            };
            // プレイヤーからBump要求のイベント
            flashManager.RequestBump += (sender, args) => parent.Bump();
            // 再生支援を使う設定が変更されたら
            PlayerSettings.Changed += (s) =>
            {
                switch (s)
                {
                case "Gpu":
                    flashManager.EnableGpu(PlayerSettings.Gpu);
                    break;

                case "Rtmp":
                    flashManager.EnableRtmp(PlayerSettings.Rtmp);
                    break;

                case "BufferTime":
                    flashManager.SetBufferTime(PlayerSettings.BufferTime);
                    break;

                case "BufferTimeMax":
                    flashManager.SetBufferTimeMax(PlayerSettings.BufferTimeMax);
                    break;
                }
            };
            // Flashウィンドウをフックする
            FlashNativeWindow flash = new FlashNativeWindow(axShockwaveFlash);

            flash.MouseDownEvent += (sender, e) =>
            {
                mouseDownEvent(this, e);
                Focus();
            };
            flash.MouseUpEvent     += (sender, e) => mouseUpEvent(this, e);
            flash.MouseMoveEvent   += (sender, e) => mouseMoveEvent(this, e);
            flash.DoubleClickEvent += (sender, e) => doubleClickEvent(this, e);
            flash.KeyDownEvent     += (sender, e) => keyDownEvent(this, e);
        }
		public FlashMoviePlayerControl(PecaPlayerControl parent)
		{
			try
			{
				InitializeComponent();
			}
			catch (COMException)
			{
				MessageBox.Show("Flash Playerがインストールされていません。\nInternet ExplorerからFlash Playerをインストールする必要があります。",
					"ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			
			Dock = DockStyle.Fill;

			// FlashManagerの初期化
			flashManager = new FlashMoviePlayerManager(axShockwaveFlash);
			flashManager.Initialized += (sender, args) =>
			{
				flashManager.EnableGpu(PlayerSettings.Gpu);
				flashManager.EnableRtmp(PlayerSettings.Rtmp);
				flashManager.SetBufferTime(PlayerSettings.BufferTime);
				flashManager.SetBufferTimeMax(PlayerSettings.BufferTimeMax);
			};
			// ステート変更イベント
			flashManager.OpenStateChange += (sender, args) =>
			{
				if (isFirstMediaOpen)
				{
					var width = ((IMoviePlayer)this).ImageWidth;
					var height = ((IMoviePlayer)this).ImageHeight;
					axShockwaveFlash.Width = width;
					axShockwaveFlash.Height = height;
					movieStart(this, new EventArgs());
					isFirstMediaOpen = false;
				}

				// 動画切替時に、ミュートが解除されるための対応
				((IMoviePlayer)this).Mute = isMute;
				if (!isMute)
				{
					flashManager.ChangeVolume(volume);
				}
			};
			// プレイヤーからBump要求のイベント
			flashManager.RequestBump += (sender, args) => parent.Bump();
			// 再生支援を使う設定が変更されたら
			PlayerSettings.Changed += (s) =>
			{
				switch (s)
				{
				case "Gpu":
					flashManager.EnableGpu(PlayerSettings.Gpu);
					break;
				case "Rtmp":
					flashManager.EnableRtmp(PlayerSettings.Rtmp);
					break;
				case "BufferTime":
					flashManager.SetBufferTime(PlayerSettings.BufferTime);
					break;
				case "BufferTimeMax":
					flashManager.SetBufferTimeMax(PlayerSettings.BufferTimeMax);
					break;
				}
			};
			// Flashウィンドウをフックする
			FlashNativeWindow flash = new FlashNativeWindow(axShockwaveFlash);
			flash.MouseDownEvent += (sender, e) =>
			{
				mouseDownEvent(this, e);
				Focus();
			};
			flash.MouseUpEvent += (sender, e) => mouseUpEvent(this, e);
			flash.MouseMoveEvent += (sender, e) => mouseMoveEvent(this, e);
			flash.DoubleClickEvent += (sender, e) => doubleClickEvent(this, e);
			flash.KeyDownEvent += (sender, e) => keyDownEvent(this, e);
		}