All Products
Search
Document Center

ApsaraVideo VOD:FAQ about Player SDK

Last Updated:Apr 21, 2025

This topic answers some commonly asked questions about the use of Player SDK on different platforms.

Which protocol should I use for standard streaming, RTMP or HTTP-FLV?

We recommend that you use the HTTP Flash Video (HTTP-FLV) protocol for live streaming.

  1. When you use the ApsaraVideo Live console to generate URLs, URLs in the RTMP and HTTP-FLV formats are generated. A URL in the RTMP format and a URL in the HTTP-FLV format contain the same data content, but use different protocols.

  2. HTTP is the primary protocol for transmission of information across the Internet. Connections over the HTTP protocol, such as connections among Alibaba Cloud CDN, Internet service providers (ISPs), and intermediary devices, are highly optimized. The default port for the HTTP protocol is 80 and the default port for the HTTPS protocol is 443. In most cases, the ports are added to the whitelist and cannot be disabled. RTMP is an outdated protocol and uses 1935 as the default port. Port 1935 may be disabled by the firewall. This may cause errors. Compared with RTMP, HTTP-FLV is more stable and provides better performance. For example, video playback over HTTP-FLV has a lower stuttering rate and lower latency than RTMP.

Playback failures

How do I troubleshoot playback failures?

Video playback failures may result from causes such as stream encoding errors, server or network errors, Alibaba Cloud CDN errors, format errors, and bucket errors. The following items describe the solutions:

  • Overdue payment errors: Check your account balance. If overdue payments exist within your Alibaba Cloud account, videos cannot be played.

  • Server or network errors: The 4400 error code is returned when your video failed to be played. The 4400 error code indicates that the resources cannot be loaded due to server or network errors. Check whether the SSL certificate is configured and whether your SSL certificate is valid.

  • Format errors: The video format is incompatible with ApsaraVideo Player SDK. For more information about the playback formats supported by ApsaraVideo VOD, see Features.

    Note

    To play M3U8 videos, you must use a custom domain name. For more information about how to add domain names, see Add a domain name for CDN.

  • Bucket errors: The specified bucket is invalid or the authentication information of a private bucket has expired. You can disable bucket authentication and set the ACL of the bucket to public-read.

  • Cross-region errors: Check whether the region of the accelerated domain name and the region in which the video is being played are the same. If the regions are different, video playback fails. In this case, you can add a new domain name to accelerate or change the region of the existing accelerated domain name.

What do I do if videos can be played in ApsaraVideo VOD but fail to be played on other platforms?

Perform the following steps to troubleshoot the error:

  1. Check whether the video still exists in ApsaraVideo VOD.

  2. Check whether an accelerated domain name is added.

    • If no accelerated domain name is added, check whether the ACL of the storage bucket is private. If the ACL of the bucket is private, disable authentication and set the ACL to public-read. This operation may introduce risks to your bucket.

    • If an accelerated domain name is added, check whether authentication is enabled. If authentication is enabled, configure a longer validity period for the signed URL, or disable authentication. If you disable authentication, your resources are exposed to risks.

Playback exceptions

What do I do if the playback is muted when I use ApsaraVideo Player to play a video?

ApsaraVideo Player is optimized for Alibaba Cloud services. If you use a playback URL from another source, the playback may be muted. In this case, check the playback source that is used by ApsaraVideo Player.

Long startup duration

  • If the startup duration is long when you play an MP4 video, the playback error may be caused by the format of the video file. To accelerate data parsing, you must place the moov atom before the mdat atom. The mdat atom contains the media data and the moov atom acts as the index of media data. You can transcode the media file to move the moov atom ahead of the mdat atom.

    • For more information, see Recommended output formats and transcoding tools.

    • To check the location of the moov atom, run the following command:

      # The video source address can be the path of a local file or the URL of an online video. Example: http://pla****.alicdn.com/video/aliyunmedia.mp4.
      ffmpeg -v trace -i "Video source address" 2>&1 | grep -e type:\'mdat\' -e type:\'moov\'

      In the following figure, the moov atom is placed ahead of the mdat atom. In this case, the video can be played as expected.最佳实践-播放异常自主排查2.png

      In the following image, the mdat atom is placed ahead of the moov atom. In this case, playback errors may occur.最佳实践-播放异常自主排查1.png

  • ApsaraVideo VOD provides playback solutions for ApsaraVideo Player SDKs for Android and iOS that reduce the startup duration to milliseconds. For more information, see Use ApsaraVideo Player to perform instant loading in full screen mode.

Playback of encrypted videos

What do I do if DRM-encrypted videos cannot be played by ApsaraVideo Player for Web?

You can use ApsaraVideo Player for Web to play videos that are encrypted by using Digital rights management (DRM) only on specific browsers. For more information about the supported browsers, see Features supported by browsers.

What is MtsHlsUriToken used for when I play HLS-encrypted videos? How do I obtain MtsHlsUriToken?

MtsHlsUriToken is a user-defined parameter. In HLS encryption, an encryption string is written to the HLS stream and the URL of the decryption server is added to the M3U8 index file. If you want to limit access to the encrypted video, you can use MtsHlsUriToken for identity verification before the video is decrypted for playback.

When you configure encryption, you must set up a token issuance service to generate MtsHlsUriToken. For more information, see Step 4 in the Encrytion procedure section of the HLS encryption topic.

Cross-region playback

What do I do if videos uploaded to OSS in the UK (London) region take a long time to load from the Chinese mainland?

Access from regions in the Chinese mainland to UK (London) is cross-region access. We recommend that you activate Global Accelerator (GA) and add a domain name to accelerate video loading.

What do I do if videos take a long time to load and video stuttering frequently occurs when I access ApsaraVideo VOD from regions outside the Chinese mainland?

In most cases, stuttering occurs when the network connection is unstable. If video stuttering continues for an extended period of time and causes an error to be reported in ApsaraVideo Player, the connection to CDN may be interrupted. If video stuttering frequently occurs, check whether your network speed matches the video bitrate. If your network speed does not match the video bitrate, increase your network speed or reduce the video bitrate.

Playback of videos stored in OSS

What do I do if a large number of requests are sent when I play a video stored in OSS?

Check whether the source video is abnormal. For example, check whether a large number of requests are sent when the player decrypts the source video. We recommend that you use an ApsaraVideo VOD transcoding template to transcode the source video for playback. For more information, see Audio and video transcoding.

How do I configure to preview the image when I click the URL of an image that is uploaded to ApsaraVideo VOD?

You can preview images stored in ApsaraVideo VOD only by using custom domain names. If you use the default domain name to access an image, the image is forcibly downloaded. You can add your custom domain name to ApsaraVideo VOD. For more information, see Add a domain name for CDN.

SSL certificates

What do I do if videos cannot be played on specific PCs and the 4400 error code is returned?

The 4400 error code indicates that the resources cannot be loaded due to server or network errors, or that the video format is not supported. Check whether an SSL certificate is configured.

Playback URLs

How do I generate a short playback URL for a video stored in ApsaraVideo VOD?

If the ACL of the bucket in which the video is stored is private, the video playback URL contains authentication information and the URL is long. If the ACL of the bucket is public-read or public-read-write, no authentication information is added to the playback URL and the URL is short. For more information about the read and write permissions on the storage bucket and how to change the permissions, see Manage storage buckets.

Note

If the ACL of the bucket is public-read or public-read-write, the bucket is exposed to risks of hotlinking and illegal downloads. We recommend that you set the ACL of your bucket to private.

Why does a non-transcoded video fail to be played after I set the transcoding format to HLS?

You can use a video ID and a playback credential to play only the encrypted videos in ApsaraVideo Player. Videos that are not transcoded can only be played by using a playback URL. You can call the GetMezzanineInfo operation to obtain the source video URL or log on to the ApsaraVideo VOD console to view the video playback URL.

Does a video stored in ApsaraVideo VOD have multiple playback URLs?

If the ACL of the bucket in which the video is stored is private, the playback URL of the video has an expiration time. The authentication string included in the auth_key parameter in the playback URL varies based on the expiration time that you specify.

If you need a permanent playback URL for a video, you must change the ACL of the bucket in which the video is stored to public-read or public-read-write. Then, a playback URL is generated. The content before ? is the permanent playback URL. For more information about the read and write permissions on the storage bucket and how to change the permissions, see Manage storage buckets.

Note

If the ACL of the bucket is public-read or public-read-write, the bucket is exposed to risks of hotlinking and illegal downloads. We recommend that you set the ACL of your bucket to private.

Why a video uploaded to ApsaraVideo VOD can only be played in browsers after I access the playback URL of the video from platforms such as Taobao?

Video playback depends on browsers and the transcoding capabilities of your local device. In most cases, you are redirected to a browser to play videos.

Why am I unable to play the new video after I upload the updated video?

After you update the video, you must refresh the playback URL to obtain the latest video data. For more information about how to refresh the URL by using the ApsaraVideo VOD console, see Refresh and prefetch. For more information about how to refresh the URL by using the ApsaraVideo VOD API or SDK, see PreloadVodObjectCaches or RefreshMediaPlayUrls.

How do I obtain the pixels of each video frame in ApsaraVideo Player?

  • ApsaraVideo Player for Android: listen for the OnRenderFrameCallback event.

  • ApsaraVideo Player for iOS: listen for the onRenderingFrame event.

    player.renderingDelegate = self;
    
    
    #pragma mark CicadaRenderingDelegate
    - (BOOL)onRenderingFrame:(CicadaFrameInfo*) frameInfo{
        if(frameInfo.frameType==Cicada_FrameType_Video){
            // Obtain the pixels of video frames.
            NSLog(@"receive HW frame:%p pts:%ld foramt %d", frameInfo.video_pixelBuffer, frameInfo.pts, CVPixelBufferGetPixelFormatType(frameInfo.video_pixelBuffer));
    
        } else if (frameInfo.frameType==Cicada_FrameType_Audio){
            // This feature is not supported for audio.
        }
        return NO;
    }
  • ApsaraVideo Player for Web: You cannot obtain the pixels of video frames.

Why am I unable to obtain playback URLs of AVI videos uploaded to ApsaraVideo VOD by using the API or SDK?

You cannot obtain AVI videos by calling the GetPlayInfo operation. Therefore, you cannot use SDKs that use this operation to obtain playback URLs of AVI videos.

You can view the playback URL of an AVI video in the ApsaraVideo VOD console. For more information, see Query audio/video files.

Playback stuttering

What do I do to reduce video stuttering and improve the cache hit ratio?

You can configure the following settings: URL signing, refresh and prefetch, cache TTL, and parameter filtering.

What do I do if video stuttering occurs when I drag the progress handle to the middle of the progress bar?

When you drag the progress handle on the progress bar, ApsaraVideo Player loads the keyframes before and after the position to which you seek to display the required video image. Stuttering occurs in a video when the keyframes are insufficient and the required video image takes more time to be displayed. In this case, we recommend that you transcode the video to add more keyframes to the video. For more information about transcoding, see Audio and video transcoding.

Video thumbnails

Why am I unable to obtain video thumbnails?

By default, the ApsaraVideo VOD console uses the HTTPS protocol. The screenshots can be displayed and previewed only if HTTPS is used. You can also open the browser developer tool to view error details.

Video review

Why am I unable to play videos submitted for manual review?

ApsaraVideo VOD provides two review modes: Review After Publish and Review Before Publish. If you use the latter, you can play the video only after the video passes the review. The following items describe the differences between the two review modes:

  • Review After Publish: After a video is transcoded, the video is marked as Normal and can be played. You need to perform a manual review for the video in the Content Moderation module. If you block the video, the video cannot be played.

  • Review Before Publish: After a video is transcoded, the video is marked as Reviewing and cannot be played. You can play the video only after the video passes the review.

Parameter parsing

What is a video ID? Why is a video ID required? How do I obtain a video ID?

For security purposes, ApsaraVideo VOD provides you with a video ID instead of a video URL after you upload a video file. You can obtain the video URL by calling an API operation in ApsaraVideo VOD. For more information, see GetPlayInfo.

After you upload a video to ApsaraVideo VOD, you can obtain the video ID.

You can also obtain a video ID by using the ApsaraVideo VOD console. Perform the following steps to obtain a video ID:

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Media Files > Audio/Video.

  3. On the page that appears, obtain the video ID.

You can use the video ID that you obtained by using the ApsaraVideo VOD console to test the download and playback features. For more information about how to upload videos to ApsaraVideo VOD, see Overview.

What are the AccessKey ID and AccessKey secret? How do I obtain an AccessKey ID and AccessKey secret?

The AccessKey ID and AccessKey secret are the only credentials that you can use to call Alibaba Cloud APIs. The AccessKey ID is used to verify your identity. The AccessKey secret is used to encrypt the signature string of your access request. This prevents data from being tampered with. The AccessKey secret is similar to a logon password. Keep the AccessKey secret confidential.

Perform the following steps to obtain the AccessKey ID and AccessKey secret:

  1. Log on to the ApsaraVideo VOD console.

  2. Move the pointer over the profile picture in the upper-right corner and select AccessKey Management.

  3. On the AccessKey Management page, create an AccessKey pair or view the AccessKey secret of an existing AccessKey ID.

What is a playKey? How do I obtain a playKey?

A playKey is an API key. It is used for authentication when ApsaraVideo Player SDK obtains the playback URL of a video. Playback authentication is a secondary authentication mechanism that is implemented by ApsaraVideo VOD based on Alibaba Cloud AccessKey authentication. The playKey can prevent hotlinking. By default, ApsaraVideo VOD provides playKeys for Flash, HTML5, iOS, and Android to meet your video playback needs.

Note

To ensure security, if you want to view your playKey, you must enter the verification code that is sent to your mobile phone.

Perform the following steps to obtain the playKey:

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > CDN Configuration > Download. On the Download page, turn on Download. In the Turn on the download function dialog box, select Encrypted and click OK.

  3. In the Get the key section, set the Unique App Identifier and Private Key parameters.

  4. Click Generate and Download Key.

What is a playAuth? How do I obtain a playAuth?

ApsaraVideo Player plays videos in three modes that apply to different scenarios. Among the three modes, the setAuthInfo method is the most secure mode, in which a playAuth is provided.

playAuth is a playback credential in which the video ID, AccessKey ID, and AccessKey secret are packaged and encrypted. After you obtain the playAuth, you can use the string of data that contains various information to play videos in ApsaraVideo Player.

Playback mode

Scenario

Description

Recommended

setDataSource

Testing

To use this playback mode, you must write your AccessKey pair to your client. If the client is cracked, your AccessKey pair may be leaked.

We recommend that you do not use this playback mode in your business environment.

setAuthInfo

Commercial use

Secure. All video URLs and links are not exposed.

We recommend that you use this playback mode in your business environment.

Playback of local videos and online videos

Playback of local videos and videos based on URLs

Simple. Videos on other platforms can be played.

Used for playing local videos and online videos.

Process: The server obtains a playAuth and sends the playAuth to the client. Then, the client plays the video. > >

  1. You use ApsaraVideo VOD SDK to obtain a playback credential.

  2. ApsaraVideo Player SDK obtains the playback URL of the video from ApsaraVideo VOD based on the video ID and playback credential. Then, ApsaraVideo Player SDK loads and decodes the video stream, and plays the video.

Important

A playAuth is valid for 100 seconds. It is used only to obtain the streaming URL of the specified video and cannot be used for other videos or reused. If the playAuth expires, you cannot obtain the streaming URL. In this case, you must obtain the playAuth again.

ApsaraVideo Player SDK automatically obtains the streaming URL for decoding and playback based on the playAuth. The streaming URL is valid for 30 minutes. If the playAuth expires, obtain the playAuth again and send it to Player SDK to refresh the streaming URL.

To ensure the security of your Alibaba Cloud account, we recommend that you use the AccessKey pair of a RAM user, especially when you use ApsaraVideo Player SDK for Web.

References