Пример #1
0
		public void OpenRecordingSession(OCL.RecordingSession RS,
			OCL.User AccessingUser,AxUMediaControlLib.AxUMediaPlayer Preview_Player,
			AxUMediaControlLib.AxUMediaPlayer PlayBack_Player)
		{
			
			pLUser = AccessingUser;			
			PreviewPlayer = Preview_Player;
			PlayBackPlayers = new ArrayList();
			if(PlayBack_Player != null)
				PlayBackPlayers.Add(PlayBack_Player);
			TStatusChecker = new System.Timers.Timer(500);
			TStatusChecker.Elapsed +=new System.Timers.ElapsedEventHandler(TStatusChecker_Elapsed);			
	
			CameraAngles = new ArrayList();
			CurrentRecordingSession = RS;						
			PresentationViews = RS.CurrentRecordings(pLUser);									
							
			if(RS.IsPresentation)
			{				
				foreach(OCL.Recording CurrentRecording in PresentationViews)
				{
					OCL.VideoStorageServer VSS = CurrentRecording.CurrentVideoStorageServer;
					OCL.VideoStorageServerType VST = VSS.CurrentVideoStorageServerType;
								
					if(CurrentRecording.IsPrimaryCamera)
					{
						CurrentCameraIndex = CameraAngles.Count;
						CameraAngles.Add(CurrentRecording);
						try
						{
							if(VST.Description == "Windows Media Server")
							{
								try
								{
									PreviewPlayer.Stop();
								}
								catch(Exception Err)
								{
									string sPeek = Err.Message;
								}
								PreviewPlayer.UseTCP();           
								PreviewPlayer.UseMediaServer(VSS.ControlAddress + ":5119");
								PreviewPlayer.UseFile(VSS.StorageDirectory + @"\" + CurrentRecording.Description);											
							}
						}
						catch(Exception Err)
						{
							MessageBox.Show(Err.Message,"Error occurred while loading media");
							return;
						}
					}
					else if(CurrentRecording.IsDesktopCapture)
					{
						try
						{
							if(PlayBackPlayers.Count != 1)
							{								
								throw new Exception("Functional Error: Not enough cameras are available to display Presentation");
							}
							if(VST.Description == "Windows Media Server")
							{								
								try
								{
									((AxUMediaControlLib.AxUMediaPlayer)PlayBackPlayers[0]).Stop();
								
								}
								catch(Exception Err)
								{
									string sPeek = Err.Message;
								}

								((AxUMediaControlLib.AxUMediaPlayer)PlayBackPlayers[0]).UseTCP();           
								((AxUMediaControlLib.AxUMediaPlayer)PlayBackPlayers[0]).UseMediaServer(VSS.ControlAddress + ":5119");
								((AxUMediaControlLib.AxUMediaPlayer)PlayBackPlayers[0]).UseFile(VSS.StorageDirectory + @"\" + CurrentRecording.Description);											
							}
						}
						catch(Exception Err)
						{
							MessageBox.Show(Err.Message,"Error occurred while loading media");
							return;
						} 
					}
					else
					{						
						CameraAngles.Add(CurrentRecording);
					}
				}					
			}
			else
			{				
				CurrentCameraIndex = 0;
				bool bFirstPass = true;
				foreach(OCL.Recording CurrentRecording in PresentationViews)
				{
					OCL.VideoStorageServer VSS = CurrentRecording.CurrentVideoStorageServer;
					OCL.VideoStorageServerType VST = VSS.CurrentVideoStorageServerType;
					
					if(bFirstPass)
					{
						bFirstPass = false;
						CurrentCameraIndex = CameraAngles.Count;
						CameraAngles.Add(CurrentRecording);
						try
						{
							if(VST.Description == "Windows Media Server")
							{
								try
								{
									PreviewPlayer.Stop();
								}
								catch(Exception Err)
								{
									string sPeek = Err.Message;
								}
								PreviewPlayer.UseTCP();           
								PreviewPlayer.UseMediaServer(VSS.ControlAddress + ":5119");
								PreviewPlayer.UseFile(VSS.StorageDirectory + @"\" + CurrentRecording.Description);											
							}
						}
						catch(Exception Err)
						{
							MessageBox.Show(Err.Message,"Error occurred while loading media");
							return;
						}
					}
					else
						CameraAngles.Add(CurrentRecording);					
				}				
			}			
			this.Play();
					
			TStatusChecker.Enabled = true;			
			return;
		}