Exemple #1
0
        // Custom message handler
        private void MessageHandler(int msgtype, IntPtr msgdata)
        {
            switch (msgtype)
            {
            case (int)InterProcess.MSG_MEDIA_PAUSE:
                player.Ctlcontrols.pause();
                break;

            case (int)InterProcess.MSG_MEDIA_RESUME:
                player.Ctlcontrols.play();
                break;

            case (int)InterProcess.MSG_MEDIA_SEEK:
                int pos = InterProcess.GetMessageData <int>(msgdata);
                player.Ctlcontrols.currentPosition = (double)pos;
                break;

            case (int)InterProcess.MSG_MEDIA_START:
                MEDIASTARTDATA startdata = InterProcess.GetMessageData <MEDIASTARTDATA>(msgdata);
                muxingfile = startdata.muxfilename;
                PlayFile(startdata.filename, startdata.startpos);
                break;

            case (int)InterProcess.MSG_MEDIA_STOP:
                stopintended = true;
                updatetimer.Stop();
                muxingfileplaying = "";
                muxplayer.Ctlcontrols.stop();
                muxplayer.close();
                player.Ctlcontrols.stop();
                player.close();
                break;
            }
        }
        // Receive messages
        public void MessageHandler(int msgtype, IntPtr msgdata)
        {
            switch (msgtype)
            {
            case (int)InterProcess.MSG_MEDIA_ENDED:
                MediaEnded();
                break;

            case (int)InterProcess.MSG_MEDIA_LENGTH:
                medialength = InterProcess.GetMessageData <int>(msgdata);
                ShowMediaInfo(currentmediapos, medialength);
                break;

            case (int)InterProcess.MSG_MEDIA_POSITION:
                currentmediapos = InterProcess.GetMessageData <int>(msgdata);
                ShowMediaInfo(currentmediapos, medialength);
                break;
            }
        }