private void LaunchPlayer() { #if !DEBUG fFS = new frmFindSession(); fFS.ShowInTaskbar = true; fFS.ShowDialog(this); #elif DEBUG frmSessionPlayback frmS = new frmSessionPlayback(); frmS.ShowInTaskbar = true; frmS.ShowDialog(this); #endif }
private void btnView_Click(object sender, System.EventArgs e) { frmSessionPlayback frmSP = new frmSessionPlayback(); if(lvSearchResults.SelectedItems[0].Tag is OCL.RecordingSession) { try { // if(PreviewPlayer.IsUMPlayer) // ((AxUMediaControlLib.AxUMediaPlayer)PreviewPlayer.Player).Stop(); // else ((AxWMPLib.AxWindowsMediaPlayer)PreviewPlayer.Player).Ctlcontrols.stop(); } catch(Exception Err) { string peek = Err.Message; } System.Collections.Specialized.HybridDictionary RecordingCollection = new System.Collections.Specialized.HybridDictionary(false); OCL.RecordingSession RS = (OCL.RecordingSession)lvSearchResults.SelectedItems[0].Tag; bool IsPresentation = RS.IsPresentation; frmSP.PreviewPlayer.Text = RS.Description; frmSP.RS = RS; int CamCount = 0; foreach(OCL.Recording R in RS.CurrentRecordings(LUser)) { OCL.VideoStorageServer VSS2 = R.CurrentVideoStorageServer; string sDirectory = @"\Data"; try { string[] checkPath = VSS2.FileStorageDirectory.Split(@"\".ToCharArray()); if(checkPath[0] == "") sDirectory = VSS2.FileStorageDirectory; else sDirectory = @"\" + VSS2.FileStorageDirectory; if(checkPath.Length > 1) { if(checkPath[checkPath.Length - 1] != @"") sDirectory += @"\"; } } catch(Exception Err) { String peekThisFunky = Err.Message; } string sURL = sLocalDrive + sDirectory + R.Description; OysterPlaybackControls.PlayListItem PLI = null; PreviewPlayer.CurrentPlayerType = OysterPlaybackControls.PlayerType.WindowMediaPlayer; // if(PreviewPlayer.IsUMPlayer) // { // PLI = new OysterPlaybackControls.PlayListItem(R.DisplayName,OysterPlaybackControls.PlaybackTransportType.TCP, // OysterPlaybackControls.PlaybackMediaType.File,sURL,VSS2.ControlAddress,VSS2.ControlPort); // } // else { PLI = new OysterPlaybackControls.PlayListItem(R.DisplayName,OysterPlaybackControls.PlaybackTransportType.WMPStream, OysterPlaybackControls.PlaybackMediaType.WMPFile,sURL,VSS2.ControlAddress,VSS2.ControlPort); } //frmSP.PreviewPlayer.PlayList.Add(PLI); /// IF CURRENT RECORDING IS THE DEFAULT CAMERA THEN SET THE PLAYLIST TO SHOW THIS RECORDING FIRST if(R.IsPrimaryCamera) { RecordingCollection.Add("Primary",PLI); //frmSP.PreviewPlayer.CurrentPlayListItem = frmSP.PreviewPlayer.PlayList.Count - 1; } else if(R.IsDesktopCapture) { RecordingCollection.Add("Presentation",PLI); //frmSP.psPlayer.Add(R.DisplayName,PLI,true); } else { RecordingCollection.Add("Camera" + CamCount.ToString(),PLI); CamCount++; //frmSP.psPlayer.Add(R.DisplayName,PLI,true); } } /////////////////////////////////////////////////////// /// Load appropriate PlayerWindows in the correct Order OysterPlaybackControls.PlayListItem StoredPLI = null; /// Primary Camera if((StoredPLI = RetrieveRecording(RecordingCollection,"Primary")) != null) { frmSP.PreviewPlayer.PlayList.Add(StoredPLI); } /// All Non-Primary Cameras for(int i=0;i<CamCount;i++) { if((StoredPLI = RetrieveRecording(RecordingCollection,"Camera" + i.ToString())) != null) { frmSP.PreviewPlayer.PlayList.Add(StoredPLI); if(!RS.IsPresentation) { frmSP.psPlayer.Add(StoredPLI.Name,StoredPLI,true); } } } /// Presentation Capture if((StoredPLI = RetrieveRecording(RecordingCollection,"Presentation")) != null) { frmSP.PreviewPlayer.PlayList.Add(StoredPLI); frmSP.psPlayer.Add(StoredPLI.Name,StoredPLI,true); } frmSP.PreviewPlayer.CurrentPlayListItem = 0; // /// IF CURRENT RECORDING IS THE DEFAULT CAMERA THEN SET THE PLAYLIST TO SHOW THIS RECORDING FIRST // if(R.IsPrimaryCamera) // { // frmSP.PreviewPlayer.CurrentPlayListItem = frmSP.PreviewPlayer.PlayList.Count - 1; // } // else if(R.IsDesktopCapture) // { // frmSP.psPlayer.Add(R.DisplayName,PLI,true); // } // else // { // frmSP.psPlayer.Add(R.DisplayName,PLI,true); // } } frmSP.lblRecordingIdentifier.Text = "1 of " + frmSP.PreviewPlayer.PlayList.Count.ToString(); lblRecordingIdentifier.Visible = true; frmSP.PreviewPlayer.OpenPlayList(); //this.Visible = false; frmSP.ShowDialog(this); this.Visible = true; frmSP.Dispose(); }