如何播放 .ism/manifest 文件? [英] How to play .ism/manifest file?
问题描述
我正在开发 iOS 应用程序并想使用 Xamarin 播放以下文件,但没有找到播放 .ism
/manifest
文件的任何解决方案.
我正在使用以下代码播放音频文件.
AVPlayer player = new AVPlayer();var playerItem = (url != null) ?新的 AVPlayerItem(url) : null;player.ReplaceCurrentItemWithPlayerItem (playerItem);播放器播放()
如何播放这个文件?
1) 您的网址丢失 (format=m3u8-aapl)
2) 不要让你的 AVPlayer
超出范围,在 UIViewController
级别保持对它的引用.
如果您通过单视图模板创建 iOS 项目,请将 ViewController
类中的 ViewDidLoad
方法替换为以下内容,您的音频"将播放.>
仅供参考:该网址实际上还提供视频...
AVPlayer播放器;公共覆盖无效 ViewDidLoad(){base.ViewDidLoad();var url = new NSUrl("https://amssamples.streaming.mediaservices.windows.net/91492735-c523-432b-ba01-faba6c2206a2/AzureMediaServicesPromo.ism/manifest(format=m3u8-aapl)");播放器 = 新 AVPlayer();player.ReplaceCurrentItemWithPlayerItem(new AVPlayerItem(url));播放器播放();}
I am developing the iOS app and wanted to play below file using Xamarin, but did not get any solution to play .ism
/manifest
file.
I am using below code to play the audio file.
AVPlayer player = new AVPlayer ();
var playerItem = (url != null) ? new AVPlayerItem(url) : null;
player.ReplaceCurrentItemWithPlayerItem (playerItem);
player.Play()
How to play this file?
1) Your URL is missing (format=m3u8-aapl)
2) Do not let your AVPlayer
go out of scope, hold a reference to it at the UIViewController
level.
If you create an iOS project via the single view template, replace the ViewDidLoad
method in the ViewController
class with the following and your "audio" will play.
FYI: The URL is actually providing video also...
AVPlayer player;
public override void ViewDidLoad()
{
base.ViewDidLoad();
var url = new NSUrl("https://amssamples.streaming.mediaservices.windows.net/91492735-c523-432b-ba01-faba6c2206a2/AzureMediaServicesPromo.ism/manifest(format=m3u8-aapl)");
player = new AVPlayer();
player.ReplaceCurrentItemWithPlayerItem(new AVPlayerItem(url));
player.Play();
}
这篇关于如何播放 .ism/manifest 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!