本文整理汇总了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);
}
示例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);
}