public void Run() { Console.SetWindowSize(80, 80); Console.Clear(); Console.SetCursorPosition(0, 10); mediaplayer = new Mediaplayer("", ""); try { mediaplayer.OnServerConnect += new MP_OnServer(DoOnServerConnect); mediaplayer.OnServerDisconnect += new MP_OnServer(DoOnServerDisconnect); mediaplayer.OnStateChangeMediaplayer += new MP_OnStateChangeMediaplayer(DoOnStateChangeMediaplayer); mediaplayer.OnCurrentMediaItemChanged += new PL_OnMediaItemChanged(DoOnCurrentMediaItemChanged); mediaplayer.OnPreviousMediaItemChanged += new PL_OnMediaItemChanged(DoOnPreviousMediaItemChanged); mediaplayer.OnNextMediaItemChanged += new PL_OnMediaItemChanged(DoOnNextMediaItemChanged); mediaplayer.OnPlaylistStart += new MP_OnPlaylist(DoOnPlaylistStart); mediaplayer.OnPlaylistEnd += new MP_OnPlaylist(DoOnPlaylistEnd); mediaplayer.OnMediaItemStartPlay += new MP_OnMediaItem(DoOnMediaItemStartPlay); mediaplayer.OnMediaItemEndPlay += new MP_OnMediaItem(DoOnMediaItemEndPlay); mediaplayer.OnMediaItemSeekStart += new MP_OnMediaItem(DoOnMediaItemSeekStart); mediaplayer.OnMediaItemSeekEnd += new MP_OnMediaItem(DoOnMediaItemSeekEnd); mediaplayer.OnTick += new MP_OnTick(DoOnTick); mediaplayer.RTMPServerLink = new ServerLink("rtmp://127.0.0.1:1935/vod"); mediaplayer.Connect(); NewPlaylist(); // Wait until we are connected (needed because we run async) while (!mediaplayer.IsConnected && !mediaplayer.LastConnectFailed) { Thread.Sleep(100); } //while //mediaplayer.ChangeCurrentMediaItemIndex(1); ExecMenu(); } finally { // Needed to stop thread and stop the program if (mediaplayer != null) { mediaplayer.Close(); } } }
public MainForm() { InitializeComponent(); // put key for bass.net here if you have them (oterwhise you'll see a nag screen) mediaplayer = new Mediaplayer("", ""); lbPlaylist.Items.Clear(); lConnectStatus.Text = ""; lFilename.Text = ""; bTogglePlay.Text = "Play"; tbLog.Text = ""; lPrevious.Text = ""; lNext.Text = ""; lPreBuf.Visible = false; NewPlaylist(); tbVolume.Value = mediaplayer.Volume; UpdateScreenPlaylist(); mediaplayer.OnServerConnect += new MP_OnServer(DoOnServerConnect); mediaplayer.OnServerDisconnect += new MP_OnServer(DoOnServerDisconnect); mediaplayer.OnStateChangeMediaplayer += new MP_OnStateChangeMediaplayer(MP_OnStateChangeMediaplayer); mediaplayer.OnControleButtonStateChange += new MP_OnControleButtonStateChange(MP_OnControleButtonStateChange); mediaplayer.OnCurrentMediaItemChanged += new PL_OnMediaItemChanged(DoOnCurrentMediaItemChanged); mediaplayer.OnPreviousMediaItemChanged += new PL_OnMediaItemChanged(DoOnPreviousMediaItemChanged); mediaplayer.OnNextMediaItemChanged += new PL_OnMediaItemChanged(DoOnNextMediaItemChanged); mediaplayer.OnPlaylistStart += new MP_OnPlaylist(DoOnPlaylistStart); mediaplayer.OnPlaylistEnd += new MP_OnPlaylist(DoOnPlaylistEnd); mediaplayer.OnMediaItemStartPlay += new MP_OnMediaItem(DoOnMediaItemStartPlay); mediaplayer.OnMediaItemEndPlay += new MP_OnMediaItem(DoOnMediaItemEndPlay); mediaplayer.OnMediaItemSeekStart += new MP_OnMediaItem(DoOnMediaItemSeekStart); mediaplayer.OnMediaItemSeekEnd += new MP_OnMediaItem(DoOnMediaItemSeekEnd); mediaplayer.OnPreBuffer += new MP_OnPreBuffer(MP_OnPreBuffer); mediaplayer.OnTick += new MP_OnTick(DoOnTick); mediaplayer.TriggerMediaItemEvents(); mediaplayer.TriggerButtonStateEvent(); mediaplayer.RTMPServerLink = new ServerLink("rtmp://127.0.0.1:1935/vod"); mediaplayer.Connect(); }