【问题标题】:Streaming video hosted in Azure Media Services on iOS (Xamarin)在 iOS (Xamarin) 上的 Azure 媒体服务中托管的流式视频
【发布时间】:2017-02-03 23:38:44
【问题描述】:

我在 Azure 媒体服务中托管了一个视频。我已经使用 H264 多比特率 1080p 编码预设对视频进行了编码(我也尝试过其他的)。发布流媒体后,我得到以下端点。 (我在下面用 mysite 替换了我的实际站点名称)

Smooth Streaming
http://mysite.streaming.mediaservices.windows.net/eaaa9f34-e39a-4393-a93b-14a7609ebd27/sampleVid.ism/manifest

MPEG-DASH
http://mysite.streaming.mediaservices.windows.net/eaaa9f34-e39a-4393-a93b-14a7609ebd27/sampleVid.ism/manifest(format=mpd-time-csf)

HLS(v3)
http://mysite.streaming.mediaservices.windows.net/eaaa9f34-e39a-4393-a93b-14a7609ebd27/sampleVid.ism/manifest(format=m3u8-aapl-v3)

HLS(v4)
http://mysite.streaming.mediaservices.windows.net/eaaa9f34-e39a-4393-a93b-14a7609ebd27/sampleVid.ism/manifest(format=m3u8-aapl)

我已成功使用 HLS(v4) url 为 android 流式传输视频,所以我知道视频有效。

对于 ios,我遵循了本教程。 https://developer.xamarin.com/recipes/ios/media/video_and_photos/play_a_video_using_avplayer/

我可以成功播放本地视频。我还能够按照这个苹果教程播放远程视频。 https://developer.apple.com/library/prerelease/content/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/02_Playback.html

我使用的网址一定有问题,但我不知道是什么。这是我的 ViewDidLoad 方法中的代码。

        var myUrl = NSUrl.FromString("http://myurl.streaming.mediaservices.windows.net/eaaa9f34-e39a-4393-a93b-14a7609ebd27/sampleVid.ism/manifest(format=m3u8-aapl)");         
        var appleUrl = NSUrl.FromString("http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8");

        _playerItem = new AVPlayerItem(myUrl);

        _player = new AVPlayer(_playerItem);

        _playerLayer = AVPlayerLayer.FromPlayer(_player);
        _playerLayer.Frame = ProfileVideoContainerView.Frame;
        ProfileVideoContainerView.Layer.AddSublayer(_playerLayer);
        _player.Play();

myUrl 不起作用,但 appleUrl 起作用。

【问题讨论】:

    标签: ios xamarin.ios avplayer http-live-streaming azure-media-services


    【解决方案1】:

    原来我只需要使用 https 而不是 http。我以为我已经尝试过了,但显然没有。另外,我不确定为什么 appleUrl 可以与 http 一起使用。

    【讨论】:

      【解决方案2】:

      iOS 的“功能”不允许连接到 http 端点,除非该端点在 info.plist 中列为允许的不安全连接。我已经忘记了这一点,并在几天/几周前被它抓住了。我认为这个功能是用 iOS9 实现的,但我不是 100% 确定这一点。它可能在此之前已经实施。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-06-02
        • 2016-09-07
        • 1970-01-01
        • 1970-01-01
        • 2018-07-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多