예제 #1
0
        /*
         * [基本属性]  
         *  URL:String; 指定媒体位置,本机或网络地址
         *  uiMode:String; 播放器界面模式,可为 full,mini,none,invisible
         *  playState:integer; 播放状态,1=停止,2=暂停,3=播放,6=正在缓冲,9=正在连接,10=准备就绪
         *  enableContextMenu:Boolean; 启用/禁用右键菜单
         *  fullScreen:boolean; 是否全屏显示
         * [controls] wmp.controls //播放器基本控制
         *  controls.play; 播放
         *  controls.pause; 暂停
         *  controls.stop; 停止
         *  controls.currentPosition:double; 当前进度
         *  controls.currentPositionString:string; 当前进度,字符串格式。如“00:23”
         *  controls.fastForward; 快进
         *  controls.fastReverse; 快退
         *  controls.next; 下一曲
         *  controls.previous; 上一曲
         * [settings] wmp.settings //播放器基本设置
         *  settings.volume:integer; 音量,0-100
         *  settings.autoStart:Boolean; 是否自动播放
         *  settings.mute:Boolean; 是否静音
         *  settings.playCount:integer; 播放次数
         *  [currentMedia] wmp.currentMedia //当前媒体属性
         *  currentMedia.duration:double; 媒体总长度
         *  currentMedia.durationString:string; 媒体总长度,字符串格式。如“03:24”
         *  currentMedia.getItemInfo(const string); 获取当前媒体信息"Title"=媒体标题,"Author"=艺术家,"Copyright"=版权信息,"Description"=媒体内容描述,"Duration"=持续时间(秒),"FileSize"=文件大小,"FileType"=文件类型,"sourceURL"=原始地址
         *  currentMedia.setItemInfo(const string); 通过属性名设置媒体信息
         *  currentMedia.name:string; 同 currentMedia.getItemInfo("Title")
         * [currentPlaylist] wmp.currentPlaylist //当前播放列表属性
         *  currentPlaylist.count:integer; 当前播放列表所包含媒体数
         *  currentPlaylist.Item[integer]; 获取或设置指定项目媒体信息,其子属性同wmp.currentMedia
         *  AxWindowsMediaPlayer控件的属性
         *  MediaPlayer1.Play          播放
         *  MediaPlayer1.Stop          停止
         *  MediaPlayer1.Pause          暂停
         *  MediaPlayer1.PlayCount        文件播放次数
         *  MediaPlayer1.AutoRewind       是否循环播放
         *  MediaPlayer1.Balance         声道
         *  MediaPlayer1.Volume         音量
         *  MediaPlayer1.Mute          静音
         *  MediaPlayer1.EnableContextMenu    是否允许在控件上点击鼠标右键时弹出快捷菜单
         *  MediaPlayer1.AnimationAtStart    是否在播放前先播放动画
         *  MediaPlayer1.ShowControls      是否显示控件工具栏
         *  MediaPlayer1.ShowAudioControls    是否显示声音控制按钮
         *  MediaPlayer1.ShowDisplay       是否显示数据文件的相关信息
         *  MediaPlayer1.ShowGotoBar       是否显示Goto栏
         *  MediaPlayer1.ShowPositionControls  是否显示位置调节按钮
         *  MediaPlayer1.ShowStatusBar      是否显示状态栏
         *  MediaPlayer1.ShowTracker       是否显示进度条
         *  MediaPlayer1.FastForward       快进
         *  MediaPlayer1.FastReverse       快退
         *  MediaPlayer1.Rate          快进/快退速率
         *  MediaPlayer1.AllowChangeDisplaySize 是否允许自由设置播放图象大小
         *  MediaPlayer1.DisplaySize       设置播放图象大小
         *                 1-MpDefaultSize         原始大小
         *                 2-MpHalfSize           原始大小的一半
         *                 3-MpDoubleSize          原始大小的两倍
         *                 4-MpFullScreen          全屏
         *                 5-MpOneSixteenthScreen      屏幕大小的1/16
         *                 6-MpOneFourthScreen       屏幕大小的1/4
         *                 7-MpOneHalfScreen        屏幕大小的1/2
         *  MediaPlayer1.ClickToPlay       是否允许单击播放窗口启动Media Player
         *
         */


        private void CloseMedia()
        {
            try
            {
                this.MediaStop();

                if (ShowApp.NowMediaIsShow)
                {
                    ShowApp.NowMediaIsShow = false;

                    MediaTempleteItem mtItem = PlayApp.ExecutePlayList.CurrentTempleteItem as MediaTempleteItem;
                    mtItem.ExecuteStop();
                }

                while (this.pnlShowMedia.Visible)
                {
                    try
                    { this.pnlShowMedia.Visible = false; }
                    catch { }

                    if (this.pnlShowMedia.Visible)
                    {
                        System.Threading.Thread.Sleep(10);
                    }
                }
            }
            catch (Exception ex)
            {
                LogApp.OutputErrorLog("MainForm", "CloseMedia", ex);
            }
        }
예제 #2
0
        private void AxVLCPlayer_OnStopEvent(object sender, EventArgs e)
        {
            try
            {
                this.showMediaFlag = true;

                MediaTempleteItem mtItem = PlayApp.ExecutePlayList.CurrentTempleteItem as MediaTempleteItem;
                mtItem.ExecuteStop();
            }
            catch (Exception ex)
            {
                LogApp.OutputErrorLog("MainForm", "AxVLCPlayer_OnStopEvent", ex);
            }
            finally
            {
                this.showMediaFlag = false;
            }
        }
예제 #3
0
        private void ThreadShowMediaVoid()
        {
            if (showMediaFlag == false)
            {
                showMediaFlag = true;

                try
                {
                    if (MediaIsReady())
                    {
                        MediaTempleteItem mtItem = PlayApp.ExecutePlayList.CurrentTempleteItem as MediaTempleteItem;

                        if (mtItem.CurrentIsChanged())
                        {
                            if (IniFileInfo.MediaDevice == MediaDeivceType.WMP)
                            {
                                mtItem.ShowCurrent(this.axWMP, WMPLib.WMPPlayState.wmppsPlaying, 0);
                            }
                            else if (IniFileInfo.MediaDevice == MediaDeivceType.VLC)
                            {
                                mtItem.ShowCurrent(this.axVLCPlayer, this.pnlShowMedia.Handle);
                            }
                        }

                        if (mtItem.ReadaheadOverTime(IniFileInfo.MediaReadaheadTime))
                        {
                            this.CloseMedia();
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogApp.OutputErrorLog("MainForm", "ThreadShowMediaVoid", ex);
                }
                finally
                {
                    showMediaFlag = false;
                }
            }
        }