public static IVideoPlayer getVideoPlayer(string videoPlayerName, string videoFile, Panel videoOwner, Panel stepsOwner, VideoUserOptions pVideoUserOptions) { if (videoFile.Contains(".mp3")) { if (m_Mp3Player == null) m_Mp3Player = new MP3VideoWrapper(videoFile, videoOwner); return m_Mp3Player; } if (videoPlayerName.CompareTo(ProjectConstants.DIRECTX_VIDEO_PLAYER_NAME) == 0) { if (m_DirectXPlayer == null) m_DirectXPlayer = new DirectXVideoWrapper(videoFile, videoOwner); return m_DirectXPlayer; } else if (videoPlayerName.CompareTo(ProjectConstants.DIRECT_SHOW_VIDEO_PLAYER_NAME) == 0) { return new DirectShowVideoWrapper(videoFile, videoOwner, stepsOwner, pVideoUserOptions); } else if (videoPlayerName.CompareTo(ProjectConstants.DUMMY_VIDEO_PLAYER_NAME) == 0) { return new DummyVideoWrapper(); } throw new VideoPlayerNotFoundException(); }
public FrameOverlay(string pVideoInfoFilepath,VideoUserOptions pVideoUserOptions) { mVideoInfoFilepath = pVideoInfoFilepath; mFrameOverlayItemList = new List<FrameOverlayItem>(); mCurrentRetrievalIndex = -1; VideoUserOptions = pVideoUserOptions; mFrameOverlayStorage = new Dictionary<int, FrameOverlayDisplayItems>(); mFrameMilestoneEventList = new List<string>(); // NumberOfItemsForStars = new Dictionary<string, ItemsRating>(); //For test // addRatingItem("PartsOfTheFeetScoring", 5); // addRatingItem("ToeStandsScoring", 4); // addRatingItem("PopOversScoring", 3); }
/// <summary> Use capture device zero, default frame rate and size</summary> public Capture(string FileName, string TextString, Control hWin, bool pParentWindowDisplay,VideoUserOptions pVideoUserOptions,Bitmap pRender) : this(FileName, TextString, hWin, pParentWindowDisplay, pVideoUserOptions) { bitmapRender = pRender; }
/// <summary> Use capture device zero, default frame rate and size</summary> public Capture(string pVideoInfoFilepath, string TextString, Control hWin, bool pParentWindowDisplay, VideoUserOptions pVideoUserOptions) { m_Count = 0; m_String = TextString; mParentWindowDisplay = pParentWindowDisplay; mFrameOverlay = new FrameOverlay(pVideoInfoFilepath,pVideoUserOptions); mFrameOverlay.loadFrameOverlayHeader(); _Capture(mFrameOverlay.getVideofileToPlay(), hWin); mFrameOverlay.loadFrameOverlayData(m_videoWidth, m_videoHeight); mParentWindow = hWin; mLeft = 0; mTop = 0; mAttr = new ImageAttributes(); mAttr.SetColorKey(Color.Blue, Color.Blue); // Shape.initializeShapes(m_videoWidth,m_videoHeight); }
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; } }
private void playTraining(IWiimoteReferenceRecord pReferenceRecord, VideoUserOptions pOptions) { try { if (!mTrainingStarted) initializeTraining(); if (isTrainingVideoRunning()) return; if (isTrainingVideoPaused()) { mVideoPlayer.resume(); return; } if (mCurrentVideoIndex == WiimoteDataStore.getWiimoteDataStore().getNumberOfTrainingSegmentInfoRecords()) return; playTrainingVideo(pReferenceRecord,pOptions); } catch (WiimoteConnectionException ex) { throw ex; } }
private void OpenTrainingVideo(string pVideoInfo, VideoUserOptions pOptions) { Panel videoPanel = mOutputParent.getTrainingVideoPlayerPanel(); // open the video // remember the original dimensions of the panel int height = videoPanel.Height; int width = videoPanel.Width; mVideoPlayer = VideoPlayerFactory.getVideoPlayer(ProjectConstants.DIRECT_SHOW_VIDEO_PLAYER_NAME, pVideoInfo, videoPanel, null, pOptions); //mVideoPlayer = VideoPlayerFactory.getVideoPlayer(ProjectConstants.DUMMY_VIDEO_PLAYER_NAME, pVideoInfo, videoPanel, null, pOptions); mOutputParent.SetPanelDimensions(width * 3 / 2, height); // play the first frame of the video so we can identify it mVideoPlayer.load(); }
public bool slowMoTraining() { if (!mCurrentTrainingSegment.SlowMoOption) return false; VideoUserOptions lOptions = new VideoUserOptions(); lOptions.SlowMo = true; IWiimoteReferenceRecord lSlowMoReferenceRecord = mCurrentTrainingSegment.getSlowMoReferenceRecord(); if (lSlowMoReferenceRecord == null) return false; playTraining(lSlowMoReferenceRecord,lOptions); return true; }
public bool scoreTraining() { if (!mCurrentTrainingSegment.ScoringOption) return false; IWiimoteReferenceRecord lScoringReferenceRecord = mCurrentTrainingSegment.getScoringReferenceRecord(); if (lScoringReferenceRecord == null) return false; VideoUserOptions lOptions = new VideoUserOptions(); playTraining(lScoringReferenceRecord, lOptions); return true; }
public bool playTraining() { VideoUserOptions lVideoUserOptions = new VideoUserOptions(); IWiimoteReferenceRecord lRecord = mCurrentTrainingSegment.getReferenceRecord(mCurrentSubVideoIndex); if (lRecord.SlowMoOption) lVideoUserOptions.SlowMo = true; playTraining(lRecord, lVideoUserOptions); return true; }
private void SlowMoCommand_Click(object sender, EventArgs e) { try { VideoUserOptions lOptions = new VideoUserOptions(); lOptions.SlowMo = true; continueTraining(lOptions); } catch (WiimoteConnectionException ex) { MessageBox.Show("Tap Rapper : Yo .. Connect your wiimotes", "Tap Rapper Says", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void RepeatCommand_Click(object sender, EventArgs e) { mCurrentVideoIndex = mCurrentVideoIndex - 1; VideoUserOptions lOptions = new VideoUserOptions(); mCurrentTrainingSegment = mVideoInfoList[mCurrentVideoIndex]; playTrainingVideo(lOptions); }
private void continueTraining(VideoUserOptions pOptions) { try { if (!mTrainingStarted) initializeTraining(); if (mCurrentVideoIndex == mVideoInfoList.Count) return; mCurrentTrainingSegment = mVideoInfoList[mCurrentVideoIndex]; playTrainingVideo(pOptions); } catch (WiimoteConnectionException ex) { throw ex; } }
public DirectShowVideoWrapper(string videoPath, Panel videoOwnerPanel, Panel stepsOwnerPanel, VideoUserOptions pVideoUserOptions) { cam = new Capture(videoPath, "Test String", videoOwnerPanel, true, pVideoUserOptions); m_StepsOwnerPanel = stepsOwnerPanel; cam.FrameMilestoneEvent += new Capture.OnFrameMilestoneEvent(OnFrameMilestoneEvent); }