コード例 #1
0
        private void playTrainingVideo(IWiimoteReferenceRecord pReferenceRecord, VideoUserOptions pOptions)
        {
            try
            {
                OpenTrainingVideo(ProjectConstants.PROJECT_MEDIA_PATH + @"\" + pReferenceRecord.VideoPath, pOptions);
                mVideoPlayer.VideoPlayCompleteEvent += new EventHandler(videoCompletedEvent);
                mVideoPlayer.FrameMilestoneEvent    += new EventHandler(frameMilestoneEvent);

                if (pReferenceRecord.ScoringOption)
                {
                    //Check to see if there is an event (Recording event) in the frame info.
                    //If there is a recording  event it indicates that recording needs to be started at that time
                    //and not right in the beginning
                    System.Collections.ObjectModel.ReadOnlyCollection <string> lEventList = mVideoPlayer.getFrameEventList();
                    bool lWiimoteEvent = false;
                    if (lEventList != null)
                    {
                        foreach (string lEventName in lEventList)
                        {
                            if (lEventName.CompareTo(ProjectConstants.TRAINING_START_RECORDING_EVENT_STRING) == 0)
                            {
                                lWiimoteEvent = true;
                            }
                        }
                    }


                    //If there is no recording event , the recording can be started right away
                    //Also start Wiimote recording a little earlier than the video play so there is some buffer recording
                    //before the actual movement starts
                    if (!lWiimoteEvent)
                    {
                        startRecording(pReferenceRecord, Configuration.getConfiguration().TrainingPreRecordingTime);
                    }
                }

                mVideoPlayer.play();

                if (pReferenceRecord.ScoringOption)
                {
                    mWiimotes.addInformationToRecording(START_VIDEO_CODE);
                }
            }
            catch (WiimoteConnectionException ex)
            {
                throw;
            }
        }