在 DELPHI 中为 AVPlayer 设置用户代理

Ziku

我正在尝试根据以下短代码在 Delphi 中设置一个User Agentfor AvPlayer

NSMutableDictionary* * *headers = [NSMutableDictionary dictionary];
[headers setObject:@"YourHeader"forKey:@"User-Agent"];
self.urlAsset = [AVURLAsset URLAssetWithURL:self.videoURL options:@{@"AVURLAssetHTTPHeaderFieldsKey" : headers}];
self.playerItem = [AVPlayerItem playerItemWithAsset:self.urlAsset];
self.player = [AVPlayer playerWithPlayerItem:self.playerItem];

我在这部分遇到问题:

options:@{@"AVURLAssetHTTPHeaderFieldsKey" : headers}

我已将标头声明为NSMutableDictionarysetobject带有必要的字段,但是我应该如何将其分配给键AVURLAssetHTTPHeaderFieldsKey

我使用ALVideoPlayerAlcinoe图书馆,我需要设置用户代理那里。

戴夫·诺塔奇

似乎正在做与此等效的事情:

uses
  Macapi.Foundation, Macapi.Helpers, Macapi.AVFoundation;

var
  LDictionary: Pointer;
  LOptions: NSDictionary;
  LURLAsset: AVURLAsset;
  LVideoURL: NSURL;
begin
  // Make sure you initialize LVideoURL with whatever value it is expecting
  LDictionary := TNSDictionary.OCClass.dictionaryWithObject(StringToID('YourHeader'), StringToID('User-Agent'));
  LOptions := TNSDictionary.Wrap(TNSDictionary.OCClass.dictionaryWithObject(LDictionary, StringToID('AVURLAssetHTTPHeaderFieldsKey')));
  LURLAsset := TAVURLAsset.OCClass.URLAssetWithURL(LVideoURL, LOptions);
  // etc
end;

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章