简体   繁体   中英

How upload a video to Azure Media Services and watch it in a mobile?

Since several time, we are trying upload videos to Azure Media Service and watch it in a mobile. This works right in a PC and the situation it´s very crazy.

We upload a video to Azure Media Service using .NET API. We can watch that videos in our Azure Media Player. But NOT since Azure Administration (There is a option to watch videos). Neither in azure media player sample viewer

Then...we don´t know if the problem is in Azure Administration, Azure Media Player or whe we upload video (Create asset, encode, create locator and policy...).

This is a one of my videos: http://media6franquiciasworldw.streaming.mediaservices.windows.net/e70ca01a-0be8-4f54-911c-6f4b85c0d396/12_mixtaSaltamontes.ism/manifest

This is my code:

        //Creamos el ASSET a apartir de un archivo
        IAsset inputAsset = _context.Assets.CreateFromFile(video.PathFile, AssetCreationOptions.StorageEncrypted);

        //Encode/Codificación del vídeo. Transformamos el primer asset en otro que será el realmente difundido. Se usa un patrón (JSON/XML) definido en video.Enconder
        IAsset encodedAsset = EncodeToAdaptiveBitrate(inputAsset, AssetCreationOptions.None, video.Enconder, video.GetAssetName(), video);

        //If I use "AssetDeliveryProtocol.All", throw error: "Account is not enabled for HDS streaming"
        IAssetDeliveryPolicy policy = _context.AssetDeliveryPolicies.Create("Clear Policy", AssetDeliveryPolicyType.NoDynamicEncryption, AssetDeliveryProtocol.SmoothStreaming, null);
        encodedAsset.DeliveryPolicies.Add(policy);

        // Publish the output asset by creating an Origin locator for adaptive streaming
        _context.Locators.Create(
            LocatorType.OnDemandOrigin,
            encodedAsset,
            AccessPermissions.Read,
            TimeSpan.FromDays(3650));

And here it is my "Encoder": https://pastebin.com/zQ8rS73c

I note a couple of issues that may be wrong here.

  1. Do you have a Streaming Endpoint started and running in your account? Make sure that is there first.
  2. Don't use AssetDeliveryProtocol.All. There is an issues there in the SDK where it tries to add in Adobe HDS, which we are dropping support for. You would want to only use the specific protocols that you require for streaming on the delivery protocol. So use the following pattern: AssetDeliveryProtocol.SmoothStreaming | AssetDeliveryProtocol.Dash | AssetDeliveryProtocol.HLS | AssetDeliveryProtocol.ProgressiveDownload AssetDeliveryProtocol.SmoothStreaming | AssetDeliveryProtocol.Dash | AssetDeliveryProtocol.HLS | AssetDeliveryProtocol.ProgressiveDownload

You were likely not getting any playback on iOS or Android clients due to the fact that you only set the protocol to allow SmoothStreaming, which would only be supported on desktop or custom mobile clients. Adding DASH for Android, and Apple HLS for iOS should help here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM