当前位置: 首页>>代码示例>>C#>>正文


C# IPlayer.SetMetadataReciever方法代码示例

本文整理汇总了C#中IPlayer.SetMetadataReciever方法的典型用法代码示例。如果您正苦于以下问题:C# IPlayer.SetMetadataReciever方法的具体用法?C# IPlayer.SetMetadataReciever怎么用?C# IPlayer.SetMetadataReciever使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPlayer的用法示例。


在下文中一共展示了IPlayer.SetMetadataReciever方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VideoStartup

		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);
		}
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:74,代码来源:MetadataSettingsView.xaml.cs

示例2: VideoStartup

		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);
		}
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:32,代码来源:VideoPlayerView.xaml.cs


注:本文中的IPlayer.SetMetadataReciever方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。