void VideoStartup(IVideoInfo iVideo) {
			playerEngine = new HostedPlayer();
			
			var account = AccountManager.Instance.CurrentAccount;
			UserNameToken usToken = null;
			if (!account.IsAnonymous) {
				usToken = new UserNameToken(account.Name, account.Password);
			}
			playerEngine.SetMetadataReciever(new MetadataFramer((stream) => {
				using (Disposable.Create(() => stream.Dispose())) {
					var xml = new XmlDocument();
					try {
						xml.Load(stream);
						if (xml.DocumentElement != null && xml.DocumentElement.HasChildNodes) {
							
							//TODO: possible incorrect behaviour when multiple instances of odm are running
							if (AppDefaults.visualSettings.EventsCollect_IsEnabled) {
								try {
									using (var sw = AppDefaults.MetadataFileInfo.AppendText()) {
										using (var xw = XmlWriter.Create(sw, new XmlWriterSettings() { Indent = true, CloseOutput = false })) {
											xml.DocumentElement.WriteTo(xw);
										}
										sw.WriteLine();
										sw.WriteLine("<!--------------------------------------------------------------------------------!>");
									}
								} catch {
									//swallow error
								}
							}

							MetadataReceived(xml);
						}
					} catch (Exception err) {

						//TODO: possible incorrect behaviour when multiple instances of odm are running
						if (AppDefaults.visualSettings.EventsCollect_IsEnabled) {
							try {
								using (var sw = AppDefaults.MetadataFileInfo.AppendText()) {
									sw.WriteLine("<!---------------------------------------------------------------------------------");
									sw.WriteLine("ERROR: {0}", err.Message);
									sw.WriteLine("---------------------------------------------------------------------------------!>");
								}
							} catch {
								//swallow error
								dbg.Error(err);
							}
						}

						dbg.Error(err);
					}
				}
			}));
			var vs = AppDefaults.visualSettings;
			MediaStreamInfo.Transport medtranp = MediaStreamInfo.Transport.Tcp;
			switch(vs.Transport_Type){
				case TransportProtocol.http:
					medtranp = MediaStreamInfo.Transport.Http;
					break;
				case TransportProtocol.rtsp:
					medtranp = MediaStreamInfo.Transport.Tcp;
					break;
				case TransportProtocol.tcp:
					medtranp = MediaStreamInfo.Transport.Tcp;
					break;
				case TransportProtocol.udp:
					medtranp = MediaStreamInfo.Transport.Udp;
					break;
			}
			
			MediaStreamInfo mstreamInfo = new MediaStreamInfo(iVideo.MediaUri, medtranp, usToken);
			playerEngine.Play(mstreamInfo, this);

			disposables.Add(playerEngine);
		}
		void VideoStartup(Model model) {
			player = new HostedPlayer();
			var res = model.encoderResolution;
			videoBuff = new VideoBuffer(res.width, res.height);
			player.SetVideoBuffer(videoBuff);

			var account = AccountManager.Instance.CurrentAccount;
			UserNameToken utoken = null;
			if (!account.IsAnonymous) {
				utoken = new UserNameToken(account.Name, account.Password);
			}

			if (model.metadataReceiver != null) {
				player.SetMetadataReciever(model.metadataReceiver);
			}

			MediaStreamInfo.Transport transp;
			switch (model.streamSetup.transport.protocol) {
				case TransportProtocol.http:
					transp = MediaStreamInfo.Transport.Http;
					break;
				case TransportProtocol.rtsp:
					transp = MediaStreamInfo.Transport.Tcp;
					break;
				default:
					transp = MediaStreamInfo.Transport.Udp;
					break;
			}
			MediaStreamInfo mstrInfo = new MediaStreamInfo(model.mediaUri.uri, transp, utoken);
			disposables.Add(player.Play(mstrInfo, this));
			InitPlayback(videoBuff);
		}
Example #3
0
 public MediaStreamInfo(string url, Transport transport = Transport.Udp, UserNameToken userNameToken = null)
 {
     this.url           = url;
     this.transport     = transport;
     this.userNameToken = userNameToken;
 }
Example #4
0
		public MediaStreamInfo(string url, Transport transport = Transport.Udp, UserNameToken userNameToken = null) {
			this.url = url;
			this.transport = transport;
			this.userNameToken = userNameToken;
		}