private void wmPlayer_OpenStateChange(object sender, _WMPOCXEvents_OpenStateChangeEvent e)
        {
            var openStateEventArgs = new OpenStateChangedEventArgs();

            string friendlyState;
            switch ((WMPLib.WMPOpenState)e.newState)
            {
                case WMPLib.WMPOpenState.wmposUndefined: friendlyState = "Undefined"; break;
                case WMPLib.WMPOpenState.wmposPlaylistChanging: friendlyState = "PlaylistChanging"; break;
                case WMPLib.WMPOpenState.wmposPlaylistLocating: friendlyState = "PlaylistLocating"; break;
                case WMPLib.WMPOpenState.wmposPlaylistConnecting: friendlyState = "PlaylistConnecting"; break;
                case WMPLib.WMPOpenState.wmposPlaylistLoading: friendlyState = "PlaylistLoading"; break;
                case WMPLib.WMPOpenState.wmposPlaylistOpening: friendlyState = "PlaylistOpening"; break;
                case WMPLib.WMPOpenState.wmposPlaylistOpenNoMedia: friendlyState = "PlaylistOpenNoMedia"; break;
                case WMPLib.WMPOpenState.wmposPlaylistChanged: friendlyState = "PlaylistChanged"; break;
                case WMPLib.WMPOpenState.wmposMediaChanging: friendlyState = "MediaChanging"; break;
                case WMPLib.WMPOpenState.wmposMediaLocating: friendlyState = "MediaLocating"; break;
                case WMPLib.WMPOpenState.wmposMediaConnecting: friendlyState = "MediaConnecting"; break;
                case WMPLib.WMPOpenState.wmposMediaLoading: friendlyState = "MediaLoading"; break;
                case WMPLib.WMPOpenState.wmposMediaOpening: friendlyState = "MediaOpening"; break;
                case WMPLib.WMPOpenState.wmposMediaOpen:
                    openStateEventArgs.OpenState = GenericPlayerControl.OpenStates.Open;
                    friendlyState = "MediaOpen";
                    break;
                case WMPLib.WMPOpenState.wmposBeginCodecAcquisition: friendlyState = "BeginCodecAcquisition"; break;
                case WMPLib.WMPOpenState.wmposEndCodecAcquisition: friendlyState = "EndCodecAcquisition"; break;
                case WMPLib.WMPOpenState.wmposBeginLicenseAcquisition: friendlyState = "BeginLicenseAcquisition"; break;
                case WMPLib.WMPOpenState.wmposEndLicenseAcquisition: friendlyState = "EndLicenseAcquisition"; break;
                case WMPLib.WMPOpenState.wmposBeginIndividualization: friendlyState = "BeginIndividualization"; break;
                case WMPLib.WMPOpenState.wmposEndIndividualization: friendlyState = "EndIndividualization"; break;
                case WMPLib.WMPOpenState.wmposMediaWaiting: friendlyState = "MediaWaiting"; break;
                case WMPLib.WMPOpenState.wmposOpeningUnknownURL: friendlyState = "OpeningUnknownURL"; break;
                default: friendlyState = "Unknown"; break;
            }

            Logger.Debug("OpenStateChanged: " + friendlyState);

            if (OpenStateChanged != null)
            {
                OpenStateChanged(sender, openStateEventArgs);
            }
        }
Exemplo n.º 2
0
 private void wmpMain_OpenStateChange(object sender, _WMPOCXEvents_OpenStateChangeEvent e)
 {
     switch ((WMPOpenState)e.newState) {
         case WMPOpenState.wmposMediaOpen:
             // ItemInfo の読み取り
             this.currentAttribs.Clear();
             int attribCount = this.wmpMain.currentMedia.attributeCount;
             for (int i=0; i<attribCount; i++) {
                 string attribName = this.wmpMain.currentMedia.getAttributeName(i);
                 this.currentAttribs.Add(attribName, this.wmpMain.currentMedia.getItemInfo(attribName));
             }
             // entry url のよみとり
             string entryUrl = this.currentAttribs[PlayerForm.AttribNameEntryUrl];
             //音量調整
             if (this.options.AutoVolumeEnabled && !this.wmpMain.settings.mute) {
                 //一旦音量を代入
                 this.ModifyVolume();
                 //音量が変わらないことがあるのでタイマーで後から再代入
                 this.timerAutoVolume.Start();
             }
             //バナー表示
             Match dartTagMatch = PlayerForm.regexDartTag.Match(entryUrl);
             if (dartTagMatch.Success && !string.IsNullOrEmpty(dartTagMatch.Groups[1].Value)) {
                 string dartTag = dartTagMatch.Groups[1].Value;
                 dartTag = dartTag.Split(new string[] { "AR" }, StringSplitOptions.None)[0];
                 this.wbBanner.Navigate(this.CreateBannerUri(dartTag));
                 this.splitContainer2.Panel2Collapsed = false;
             } else {
                 this.splitContainer2.Panel2Collapsed = true;
                 this.wbBanner.Navigate("about:blank");
             }
             //cm_licenseとkrmの早期スキップ
             if (this.options.SkipGyaoCmEnabled && this.IsGyaoCm) {
                 this.timerSkipGyaoCm.Start();
             }
             //ステータスバー更新
             this.UpdateStatusbarText();
             //リサイズ
             if(FormWindowState.Normal == this.WindowState) {
                 if(this.IsCm) {
                     if (this.options.AutoSizeOnCmEnabled) {
                         this.tsmiResizeToVideoResolution.PerformClick();
                     }
                 } else if(this.IsMain){
                     if (this.options.AutoSizeOnNormalEnabled) {
                         this.tsmiResizeToVideoResolution.PerformClick();
                     }
                 }
             }
             break;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Handle the Player.OpenStateChange event.
        /// </summary>
        private void Player_OpenStateChange(object sender, AxWMPLib._WMPOCXEvents_OpenStateChangeEvent e)
        {
            switch ((WMPOpenState)e.newState)
            {
            case WMPOpenState.wmposBeginCodecAcquisition:
                lblOpenState.Text = "Beginning codec acquisition...";
                break;

            case WMPOpenState.wmposBeginIndividualization:
                lblOpenState.Text = "Beginning individualization...";
                break;

            case WMPOpenState.wmposBeginLicenseAcquisition:
                lblOpenState.Text = "Beginning license acquisition...";
                break;

            case WMPOpenState.wmposMediaChanging:
                lblOpenState.Text = "Media changing...";
                break;

            case WMPOpenState.wmposMediaConnecting:
                lblOpenState.Text = "Media connecting...";
                break;

            case WMPOpenState.wmposMediaLoading:
                lblOpenState.Text = "Media loading...";
                break;

            case WMPOpenState.wmposMediaLocating:
                lblOpenState.Text = "Media locating...";
                break;

            case WMPOpenState.wmposMediaOpen:
                lblOpenState.Text = "Media open";
                break;

            case WMPOpenState.wmposMediaWaiting:
                lblOpenState.Text = "Media waiting...";
                break;

            case WMPOpenState.wmposOpeningUnknownURL:
                lblOpenState.Text = "Opening unknown URL...";
                break;

            case WMPOpenState.wmposPlaylistChanged:
                lblOpenState.Text = "Playlist changed...";
                break;

            case WMPOpenState.wmposPlaylistChanging:
                lblOpenState.Text = "Playlist changing...";
                break;

            case WMPOpenState.wmposPlaylistConnecting:
                lblOpenState.Text = "Playlist connecting...";
                break;

            case WMPOpenState.wmposPlaylistLoading:
                lblOpenState.Text = "Playlist loading...";
                break;

            case WMPOpenState.wmposPlaylistLocating:
                lblOpenState.Text = "Playlist locating...";
                break;

            case WMPOpenState.wmposPlaylistOpening:
                lblOpenState.Text = "Playlist opening...";
                break;

            case WMPOpenState.wmposPlaylistOpenNoMedia:
                lblOpenState.Text = "Playlist open, no media";
                break;

            default:
                lblOpenState.Text = "";
                break;
            }
        }