This topic describes common questions and provides solutions for ApsaraVideo Player SDKs on different platforms.
RTMP vs. HTTP-FLV for standard live streaming
You can use HTTP-FLV for the following reasons:
When you generate a URL in the ApsaraVideo Live console, both RTMP and HTTP-FLV URLs are created. The data is the same for both protocols. Only the network protocol channel is different.
The HTTP protocol is a primary protocol on the internet. Network links, such as CDNs, carriers, and intermediate network devices, have long been optimized for HTTP. The default HTTP ports 80 and 443 are also common whitelisted ports and are unlikely to be disabled. The RTMP protocol is older. Its default port 1935 may be disabled by devices such as firewalls, which can cause exceptions. Therefore, in a complex network environment, HTTP-FLV is more stable and performs better than RTMP in terms of stuttering and latency.
Playback failures
How do I troubleshoot playback failures for ApsaraVideo VOD videos?
Playback failures can be caused by stream encoding issues, network endpoint or CDN problems, format issues, or bucket issues. To identify the cause, check the error messages from the player and the network requests. The following list describes common issues and their solutions:
Overdue payment: Check your account balance. If your account has an overdue payment, videos cannot be played.
Network endpoint issue: The video fails to play and error code
4400is reported. Error code4400indicates that the resource cannot be loaded because of a server or network issue. Check whether an SSL Certificate is configured and whether the HTTPS certificate has expired or is invalid.Format issue: The video format is not compatible with the player. For more information about the playback formats supported by ApsaraVideo VOD, see Player SDK features.
NoteTo play M3U8 files with authentication, you must use a custom domain name. To attach a domain name, see Add an accelerated domain name.
Bucket issue: The specified bucket is invalid, or authentication for a private bucket has expired. This causes playback failure. To resolve this, you can disable bucket authentication and set the bucket permission to public-read.
Cross-domain issue: Check whether the region of your accelerated domain name is the same as the video playback region. If they are different, playback fails. You can create a new accelerated domain name or change the region of the original one.
Errors when playing local M3U8 videos
An M3U8 file contains multiple TS shards. These shards must exist locally. The paths in the M3U8 file must point to the correct locations of these TS files. Otherwise, the files cannot be loaded. If your shards are specified as links, playback is not supported.
The following figure shows:

Local M3U8 files must be in the format shown in the preceding figure.
An ApsaraVideo VOD video plays correctly on my site but cannot be shared and played externally
You can troubleshoot the issue as follows:
Check whether the video still exists in ApsaraVideo VOD.
Check whether an accelerated domain name is added.
No accelerated domain name is added: Check the permissions of the storage bucket. Check whether the storage bucket is private. If it is private, authentication is required. To play the video directly, you can disable authentication and set the bucket permission to public-read. Note that setting a bucket to public-read poses a security risk.
An accelerated domain name is added: Check whether authentication is enabled. If it is, you can extend the validity period of the authentication or disable authentication. Note that disabling authentication poses a security risk.
Playback exceptions
Video plays without sound
ApsaraVideo Player is optimized for Alibaba Cloud products. If you use other source URLs, the video may play without sound. If you encounter this issue, first check the playback source used by your player.
Slow video startup
If an MP4 video starts slowly, the moov atom (audio and video data index) may be located after the mdat atom (audio and video data) in the source video. You can transcode the video to move the moov atom before the mdat atom. This speeds up playback parsing.
For more information about video transcoding, see Recommended transcoding templates.
To check the position of the moov atom, you can 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.
In the following image, the mdat atom is placed ahead of the moov atom. In this case, playback errors may occur.
For ApsaraVideo Player SDK for Android and ApsaraVideo Player SDK for iOS, ApsaraVideo VOD provides a millisecond-level startup solution. This solution greatly improves video startup speed. For more information, see Use ApsaraVideo Player to achieve fast-loading full-screen playback.
Encrypted video playback
A DRM-encrypted video cannot be played in a browser
When you use ApsaraVideo Player for Web to play a DRM-encrypted video, there are restrictions on the browser. For more information about supported browsers, see Feature compatibility.
What is the MtsHlsUriToken parameter required for playing HLS-encrypted videos, and how do I obtain it?
The MtsHlsUriToken parameter is a custom parameter. In standard HLS encryption, after the encryption string is written into the HLS stream, the address of a decryption server is added to the M3U8 manifest. To allow only specific users to access the video, the decryption address requires an identity authentication feature. The MtsHlsUriToken parameter adds an authentication layer to your decryption server. A special parameter is then generated based on this authentication logic and added to the decryption authentication.
When you configure encryption, you need to build a token issuance service to generate the MtsHlsUriToken. For more information, see HLS encryption - Step 4.
Cross-domain playback
Videos uploaded to OSS in the UK (London) region load slowly in the Chinese mainland
Accessing the UK (London) region from the Chinese mainland is cross-region access. You can add an accelerated domain name and then use Global Accelerator.
How do I resolve slow access and frequent stuttering when playing ApsaraVideo VOD videos outside China?
Stuttering during playback is usually caused by an unstable network. If the stuttering is long enough to cause a player error, it is likely related to CDN instability. If stuttering occurs frequently, check the network requests. The network speed may not match the video's bitrate. You may need to increase the network speed or decrease the bitrate.
OSS video playback
What should I do if many requests are sent when playing certain videos stored in OSS?
Check whether there is an issue with the source video. For example, check whether the player sends many duplicate requests when decoding the source video. You can use an ApsaraVideo VOD transcoding template to transcode the video before playback. For more information, see Video and audio transcoding.
How can I preview an image resource from ApsaraVideo VOD directly using its link, instead of downloading it?
Images stored in ApsaraVideo VOD can be previewed only if you use a custom domain name. If you use the default domain name for access, the image is forcibly downloaded. You can add a custom domain name to ApsaraVideo VOD. For more information, see Add an accelerated domain name.
SSL certificates
A video cannot be played on some computers, and error code 4400 is reported
Error code 4400 indicates that the resource cannot be loaded because of a server or network issue, or the 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 permission of the storage address for a video is private, its playback URL contains an authentication string and is a long URL. If the permission is public-read or public-read-write, the playback URL does not contain the authentication string and is a short URL. For more information about storage address permissions and how to modify them, see Manage storage buckets.
Setting the storage address permission to public-read or public-read-write poses a risk of hotlinking and illegal downloads. This setting is not recommended.
After I set the transcoding format to HLS, why can't I play videos that are not transcoded?
When you use ApsaraVideo Player with a video ID (VID) and a playback credential, you can play only transcoded videos. Videos that are not transcoded can be played only using a 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 URL.
Are the playback URLs for videos stored in ApsaraVideo VOD fixed?
When the permission of the storage address for a video is private, its playback URL is valid for a limited time. The auth_key authentication string in the playback URL varies based on the configured expiration time.
To obtain a permanent playback address, you can change the permission of the video's storage address to public-read or public-read-write. The part of the generated playback address before the ? character is a permanent address that can be used for playback indefinitely. For more information about storage address permissions and how to modify them, see Manage Storage Buckets.
Setting the storage address permission to public-read or public-read-write poses a risk of hotlinking and illegal downloads. This setting is not recommended.
After a video is uploaded to ApsaraVideo VOD, why does it redirect to a browser for playback when the URL is sent to platforms like Taobao?
Video playback depends on the decoding capabilities of the browser and the on-premises device. Therefore, it usually redirects to a browser for playback.
After I update a video, why does the new video not appear during playback?
After you update a video, you need to purge the URL to retrieve the latest data. To purge the URL in the ApsaraVideo VOD console, see Refresh and prefetch. To purge the URL using an API or SDK, see PreloadVodObjectCaches or RefreshMediaPlayUrls.
How do I get the pixels of each frame in a video from the player?
ApsaraVideo Player for Android: You can obtain the pixels by listening for the
OnRenderFrameCallbackcallback.ApsaraVideo Player for iOS: You can obtain the pixels by listening for the
onRenderingFramecallback.player.renderingDelegate = self; #pragma mark CicadaRenderingDelegate - (BOOL)onRenderingFrame:(CicadaFrameInfo*) frameInfo{ if(frameInfo.frameType==Cicada_FrameType_Video){ // Video 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){ // Audio } return NO; }ApsaraVideo Player for Web: This feature is not supported.
Why can't I get the playback URL for an AVI video in ApsaraVideo VOD using an API or SDK?
The GetPlayInfo operation does not support obtaining video streams in AVI format. Therefore, SDKs that rely on this operation cannot obtain video streams in AVI format.
You can view the playback URL of an AVI video in the ApsaraVideo VOD console. For more information, see Query audio or video files.
The GetPlayInfo operation reports the error "The video has no stream to play for the request parameter" when obtaining a video playback URL
You can troubleshoot the issue as follows:
Confirm that the storage class of the media asset is Standard.
By default, the GetPlayInfo operation returns playback streams only for media assets of the Standard storage class. To obtain playback streams for media assets of other storage classes, set the
StorageClassparameter in thePlayConfigparameter to All.
Confirm that the media asset has a transcoded stream.
To obtain a transcoded stream, you must first perform video and audio transcoding and then call the GetPlayInfo operation. To obtain the source stream URL, see GetMezzanineInfo.
Stuttering
What measures can I take to reduce video stuttering and improve the hit rate?
You can improve the hit rate in the following ways: configure URL signing, refresh and prefetch content, configure caching, and filter parameters.
The video stutters when I drag the progress bar to the middle of the video
If a video has too few keyframes, dragging the progress bar requires loading many preceding and succeeding keyframes to calculate the corresponding frame. This causes stuttering. In this case, you can transcode the video to add more keyframes and reduce stuttering. For more information about transcoding, see Video and audio transcoding.
H.266 decoder plugin
Error 0x200600001 MEDIA_PLAYER_ERROR_CODEC_VIDEO_NOT_SUPPORT occurs
If the message is vvc plugin not enabled, the business layer has not activated the plugin. You can call the AliPlayerGlobalSettings.enableCodecPlugin operation to activate the plugin.
If the message is vvc plugin not loaded, the plugin is not integrated. Check whether the plugin library is successfully imported into the project, or explicitly call loadlibrary to ensure it is loaded.
Error 0x50020002 MEDIA_PLAYER_ERROR_CODEC_PREMIUM_INVALID occurs
This indicates that a Professional Edition license was not obtained. The H.266 decoder plugin is a feature of the Professional Edition. For more information about how to obtain a Professional Edition license, see Manage licenses.
Video thumbnails
Failed to get a video thumbnail from ApsaraVideo VOD
The ApsaraVideo VOD console uses the HTTPS protocol by default. Only resources that support HTTPS can be directly previewed and displayed as screenshots. You can also open the browser's developer tools to view specific error messages.
Video review
A video cannot be played during manual review in ApsaraVideo VOD
ApsaraVideo VOD has two review modes. If the review mode is set to "review before publish", the video can be played only after it passes the review. The two review modes are as follows:
Publish before review: After a video is transcoded, it is marked as Normal by default and can be played directly. You must then manually review the video. If the video is blocked after the review, it cannot be played.
Review before publish: After a video is transcoded, it enters the review process by default and is marked as Under Review. The video can be played only after it passes the manual review.
Parameter parsing
What is a videoID, why is it needed, and how do I get it?
For security reasons, when you upload a media file to ApsaraVideo VOD, you receive a video ID (videoID) for the file, not a URL. You can also obtain the videoID by calling an ApsaraVideo VOD OpenAPI. For more information, see Get a video playback URL.
After you upload a video to ApsaraVideo VOD, you obtain a videoID.
You can also obtain the videoID in the ApsaraVideo VOD console. The procedure is as follows:
Log on to the ApsaraVideo VOD console.
In the navigation pane on the left, choose Media Library > Audio/Video.
In the video list, obtain the videoID.
You can use the videoID obtained from the console to test downloading and playback. For more information about how to upload files to ApsaraVideo VOD, see Overview of the upload SDK.
What are an AccessKey ID and an AccessKey secret, and how do I get them?
An Alibaba Cloud AccessKey ID and AccessKey secret are the only credentials for accessing Alibaba Cloud APIs. The AccessKey ID is an identity identifier. The AccessKey secret is used to sign your access parameters to prevent tampering. The AccessKey secret is similar to your logon password. Do not disclose it to anyone.
Retrieve operation:
Log on to the ApsaraVideo VOD console.
Move the mouse pointer over your profile picture in the upper-right corner and click AccessKey Management in the shortcut menu.
On the AccessKey Management page, create an AccessKey pair or view the AccessKey secret of an existing AccessKey ID.
What is a playKey, and how do I get it?
A playKey (API key) is a playback key used to authenticate the identity when the player SDK obtains a video playback URL. Playback authentication is a secondary authentication mechanism based on Alibaba Cloud AccessKey security authentication. It can effectively prevent hotlinking. By default, playKeys are provided for Flash, HTML5, iOS, and Android platforms based on the platforms that users may use for playback.
To ensure key security, you must enter a verification code sent to your mobile phone to confirm your identity when you view a playKey.
The Obtain operation:
Log on to the ApsaraVideo VOD console.
In the navigation pane on the left, in the Configuration Management area, select . Enable Secure Download Mode.
In the Get Key section, enter the Unique App ID and Offline Decryption Private Key.
Click Generate And Download Key.
What is a playauth, and how do I get it?
The player supports three playback modes for different scenarios. The playauth mode is the most secure. Use the setAuthInfo playback mode.
A playauth is an encrypted string that contains information such as the videoID, AccessKey ID, and AccessKey secret. The ApsaraVideo VOD service mixes and encrypts this information. When the player receives the playauth, it can play the video.
Playback mode | Scenarios | Pros and cons | Recommended? |
setDataSource | For testing | Risk of leakage. You must write your AccessKey ID and AccessKey secret directly into the client code. If the client is cracked, your keys may be leaked. | Not recommended for commercial use. |
setAuthInfo | For commercial use | Secure. No video URLs or links are exposed. | Recommended for commercial use |
Play local and network URLs | Can play local videos and video URLs | Simple. Can play videos from other platforms. | Use when you need to play local videos or network videos. |
Flow: .
Obtain a playback credential: On the server, call the playback authentication SDK (server-side SDK) to obtain a playback credential from the ApsaraVideo VOD service.
Complete video playback: The player SDK uses the video ID and the playback credential to obtain the video's playback URL from the ApsaraVideo VOD service. It then loads the video stream and decodes it for playback.
A playback credential is valid for 100 seconds. It can be used only to obtain the playback URL for a specific video. It cannot be reused for other videos. If a credential expires, you cannot obtain the playback URL. You must obtain a new credential.
The player SDK automatically obtains the playback URL based on the playback credential for decoding and playback. The playback URL is valid for 30 minutes. If the playback credential expires, you must obtain a new one and pass it to the player SDK to refresh the playback URL.
To ensure the security of your Alibaba Cloud account, use the AccessKey pair of a RAM user, especially in web playback scenarios.