All Products
Search
Document Center

ApsaraVideo VOD:Android player FAQ

Last Updated:Jan 29, 2026

This topic describes common issues and solutions when you use the Android player software development kit (SDK).

License issues

For issues such as an invalid or expired license, see License FAQ.

Common issues for players on different clients

Development issues

How to get the current playback progress

By default, the player SDK provides a callback for the playback progress every 500 ms. You can modify this callback interval. To retrieve the current playback progress more frequently, shorten the interval. The following code provides an example:

// Modify the callback interval.
PlayerConfig config = mAliyunLivePlayer.getConfig();
config.mPositionTimerIntervalMs = 100;// The callback interval in ms.
mAliyunLivePlayer.setConfig(config);

mAliPlayer.setOnInfoListener(new IPlayer.OnInfoListener() {
        @Override
        public void onInfo(InfoBean infoBean) {
        if(infoBean.getCode() == InfoCode.CurrentPosition){
            // The current playback progress.
            long currentPosition = infoBean.getExtraValue();
        }
    }
});

Get source audio and video data

To retrieve raw audio and video data, switch to software decoding and play an unencrypted video. The following code provides an example:

// Switch to software decoding.
mAliPlayer.enableHardwareDecoder(false);
IPlayer.RenderFrameCallbackConfig renderFrameCallbackConfig = new IPlayer.RenderFrameCallbackConfig();
// Specifies whether to return only the underlying video data address. Default value: true.
renderFrameCallbackConfig.mVideoDataAddr = false;
// Specifies whether to return only the underlying audio data address. Default value: false.
renderFrameCallbackConfig.mAudioDataAddr = false;
mAliPlayer.setRenderFrameCallbackConfig(renderFrameCallbackConfig);

mAliPlayer.setOnRenderFrameCallback(new IPlayer.OnRenderFrameCallback() {
    @Override
    public boolean onRenderFrame(FrameInfo frameInfo) {
        return false;
    }
});

Get the video width and height

You can retrieve the video width and height in one of the following three ways:

  • After the AliPlayer instance completes the `prepare` method and enters the `prepared` state, you can retrieve the width and height using the following methods:

    mAliyunPlayer.setOnPreparedListener(new IPlayer.OnPreparedListener() {
        @Override
        public void onPrepared() {
              mAliyunPlayer.getVideoWidth();
                  mAliyunPlayer.getVideoHeight();
        }
    });
  • Listen for the video size change callback:

    mAliyunPlayer.setOnVideoSizeChangedListener(new IPlayer.OnVideoSizeChangedListener() {
        @Override
        public void onVideoSizeChanged(int width, int height) {
    
        }
    });
  • You can obtain it using the track method:

    mAliyunPlayer.setOnTrackReadyListener(new IPlayer.OnTrackReadyListener() {
        @Override
        public void onTrackReady(MediaInfo mediaInfo) {
        List<TrackInfo> trackInfos = mediaInfo.getTrackInfos();
            for (TrackInfo trackInfo : trackInfos) {
            if(trackInfo.getType() == TrackInfo.Type.TYPE_VIDEO){
            trackInfo.getVideoWidth();
            trackInfo.getVideoHeight();
            }
        }
        }
    });

How to get the pixels of each video frame in the player

For the Android player, you can retrieve the pixels by listening for the OnRenderFrameCallback callback.

player.setOnRenderFrameCallback(frameInfo -> {
    if (frameInfo.frameType == FrameInfo.FrameType_video) {
        // Video data
    } else {
        // Audio data
    }
    return false;
});

Automatic bitrate switching logic

When you enable automatic bitrate switching by calling the mAliPlayer.selectTrack(TrackInfo.AUTO_SELECT_INDEX) interface, the player SDK calculates the current network speed. If the network speed can support the next bitrate level for 10 seconds, the player switches to that bitrate. Otherwise, the player does not switch.

  • When switching from a high bitrate to a low bitrate, if the network speed reaches the next bitrate level within 10 seconds, the player finishes playing the cached high-bitrate content before switching.

  • When switching from a low bitrate to a high bitrate, the player switches immediately. The switch occurs if the network speed increases to the next bitrate level for 10 seconds.

To enable automatic bitrate switching, you must first transcode the video into an adaptive bitrate stream in the console. Then, specify that the player retrieves the adaptive bitrate stream. The following code shows an example of using the VidAuth playback method:

VidAuth vidAuth = new VidAuth();
List<Definition> list = new ArrayList<>();
list.add(Definition.DEFINITION_AUTO);
vidAuth.setDefinition(list);

Custom retry logic

In network retry scenarios, the player SDK retries twice by default, with a network timeout of 15 seconds for each attempt. If both retries fail, an `Error` callback is triggered.

You can customize the retry logic. When a retry is triggered, the retry event is sent to an external service that determines the specific retry logic. The following code provides an example:

PlayerConfig config = mAliPlayer.getConfig();
// 1. Set the number of retries. In this example, it is set to 0.
config.mNetworkRetryCount = 0;
mAliPlayer.setConfig(config);

mAliPlayer.setOnInfoListener(new IPlayer.OnInfoListener() {
    @Override
    public void onInfo(InfoBean infoBean) {
        // 2. Listen for the retry event.
       if(infoBean.getCode() == InfoCode.NetworkRetry){
            // TODO: Process the logic as needed.
        }
    }
});

An unsupported protocol error occurs during ARTC stream playback

Cause 1: The player SDK is integrated, but the bridge layer (AlivcArtc) and the Real-Time Streaming (RTS) component (RtsSDK) are not.

Solution: Integrate the components. For more information, see Implement RTS stream pulling on Android.

Cause 2: The version of the bridge layer (AlivcArtc) does not match the player version.

Solution: The bridge layer (AlivcArtc) and the player must have the same version number. For more information, see Implement RTS stream pulling on Android.

Cause 3: The RTS component (RtsSDK) is not loaded.

Solution: Load the RTS component (RtsSDK) in the Application file or the target Activity as needed.

static {
    System.loadLibrary("RtsSDK");
}

Cause 4: The minSDK version is too high, and the bridge layer (AlivcArtc) is not loaded correctly.

// 1. Modify minSdk
Downgrade minSdk to 21

// 2. Manually load the ARTC library
static {
    System.loadLibrary("RtsSDK");
    System.loadLibrary("cicada_plugin_artcSource");
}

The progress bar jumps back after a seek operation

Cause: By default, the player uses inaccurate seek. After a seek operation, the player starts playback from a keyframe near the seek point.

Solution: Switch to the accurate seek mode.

How to switch between accurate and inaccurate seek modes

The following code shows how to switch the seek mode:

// Inaccurate seek.
mAliPlayer.seekTo(1000);
mAliPlayer.seekTo(1000, IPlayer.SeekMode.Inaccurate);
// Accurate seek.
mAliPlayer.seekTo(1000,IPlayer.SeekMode.Accurate);

The progress bar still jumps back after switching to the accurate seek mode

Cause: Accurate seek takes longer than inaccurate seek. If the distance from the seek point to the nearest keyframe is large and exceeds the maximum interval for accurate seek, the player SDK automatically switches to inaccurate seek. This causes the progress bar to jump back.

Solution: You can use an interface to set the maximum interval for accurate seek. Increasing the maximum interval reduces the frequency at which accurate seek switches to inaccurate seek, which improves seek accuracy. However, a longer interval means that the seek operation will take more time if the seek point is far from a keyframe. You should set a reasonable maximum interval for accurate seek based on your business needs. The following code provides an example:

// Unit: ms.
mAliPlayer.setMaxAccurateSeekDelta(10000);

Local cache: Can the cache directory be set to the internal storage directory?

Yes, you can. You can change the external storage directory of the Android device to the internal storage directory. However, you must ensure that you have access permissions to the internal storage directory for caching to work correctly.

An `encrypt check fail` error occurs during video caching

Caching is similar to downloading. If secure download is enabled, you must confirm that the encryption verification file matches your app information. You need to download the encryption verification file generated in Offline download and save it to the player SDK. For more information, see Video download. Otherwise, caching or downloading fails.

Playback issues

A crash occurs when creating the player

Troubleshoot the issue as follows:

  1. Check whether the CPU architecture is x86.

    The player SDK supports only the arm64-v8a and armeabi-v7a architectures. It does not support the x86 architecture.

  2. Check whether both the .so files and Maven dependencies for the player SDK are integrated in the project.

    For example, you may have integrated the player SDK using a Maven dependency in `build.gradle` and also integrated the player-related dynamic libraries in the `libs` directory of the project's module.

    Recommended solution: If you are using both methods, delete the dynamic libraries and use only the Maven dependency. If you must integrate dynamic libraries, check that all player SDK-related .so files are from the same version. For information about how to integrate the player SDK and obtain the dynamic libraries, see Integrate the SDK. The following figure shows the player-related dynamic libraries:crash

  3. If you integrated a partial package, confirm that the AlivcFFmpeg version dependency is correct.

    For information about AlivcFFmpeg version dependencies, see AlivcFFmpeg version dependencies.

A crash occurs while the player is running

Troubleshoot the issue as follows:

  1. Confirm whether the crash occurred in the player SDK.

    Check for a crash stack with the AliyunPlayer prefix. If a stack with this prefix exists, the issue is in the player SDK.

  2. Upgrade to the latest version of the player SDK and verify whether the issue is fixed.

  3. If the issue persists, prepare the relevant crash files (including all threads), crash logs, and crash scenario information. For more information, see How to retrieve issue logs.

Black bars appear during video playback

Troubleshoot the issue as follows:

  1. Check whether the source video itself has black bars.

  2. You can adjust the player's scaling mode using the following interface.

    /*
    SCALE_ASPECT_FILL: Fills the screen proportionally. The video is cropped.
    SCALE_ASPECT_FIT: Scales the video proportionally. Black bars may appear.
    SCALE_TO_FILL: Fills the screen without maintaining proportions. The video is distorted.
    */
    mAliPlayer.setScaleMode();
  3. If the scaling mode does not meet your needs, you can adjust the size of the SurfaceView or TextureView at the application layer.

Audio plays but no video appears

Troubleshoot the issue as follows:

  1. Play the video with another player to check whether it is an audio-only file.

  2. Confirm that the view that renders the video is configured correctly. For example, check whether a display view is set for the player or has been removed from the playback interface. For instructions on setting the display view, see Step 4 in Basic features.

An `Invalid argument` error occurs when playing a local video with read permissions

If an `Invalid argument` error occurs when you play a local video for which you have read permissions, check the file name and absolute path. Avoid using a combination of Chinese characters and spaces in the path.

A `Permission denied` error occurs when playing a local video with read permissions

To correctly use storage permissions on devices running Android 10 (Android Q) or later, you must add android:requestLegacyExternalStorage="true" to the application tag in AndroidManifest.xml. This is required because these Android versions introduced the scoped storage feature.

A `Redirect to a url` error occasionally occurs during video playback

This error may occur because the source of the video that is being played is hijacked. We recommend that you enable the HTTPDNS feature of the player to resolve this issue. For more information, see Configure HTTPDNS for Android.

A black notification bar flashes on notched screens during full-screen playback

You can resolve this by setting an immersive status bar.

Failed to play a MOV video

The Android player SDK supports MOV format videos. If playing a MOV video fails, it may be because the moov atom (audio and video data index) is located after the mdat atom (audio and video data) in the source video. You can resolve this issue by transcoding the source video to move the moov atom before the mdat atom. For more information, see Step 2: Troubleshoot the stream.

An error occurs during initialization or playback, indicating that the player SDK's .so dynamic library cannot be found

Troubleshoot the issue as follows:

  1. Check whether the CPU architecture meets the requirements.

    The player SDK supports dynamic libraries for only the arm64-v8a and armeabi-v7a architectures.

  2. Check whether the player SDK version is too old.

    If you are using player SDK V5.4.6.0-full or earlier, we recommend that you upgrade to V5.4.6.0-full-15467853 or a later version. For the latest and historical versions of the player SDK, see Android SDK release notes.

An error occurs when using AliListPlayer to play HLS (m3u8) videos

Versions of the player SDK earlier than V5.4.5.0 do not support using the list player AliListPlayer to play HLS (m3u8) videos. Starting from V5.4.5.0, HLS (m3u8) videos are supported. However, you must enable local caching. For information about how to enable local caching, see Local cache.

Does the Android player SDK support playing videos from the assets and raw folders in an Android project?

No, it does not. You need to copy the video to the phone's storage and then use the absolute path to play the video.

A 403 error occurs and playback fails after configuring local caching for an HLS video stream

Symptom: When you play an HLS (M3U8) video stream using the VidAuth playback method with local caching enabled, playback fails and a 403 error is reported.

Cause: After local caching is enabled, if you exit playback before the video is fully cached, the uncached portion is requested using the expired VidAuth information from the previous session the next time you start playback. This causes an authentication failure and a 403 error.

Solution: For player SDK V5.5.4.0 and later, if the video playback URL contains authentication parameters and the playback protocol is HLS, you can set the PlayerConfig.mEnableStrictAuthMode field to select a different authentication mode. The default value is `false`.

  • Non-strict authentication (false): Authentication is also cached. If only part of the media was cached last time, the player uses the cached authentication to make a request when playing the non-cached part next time. If the validity period of the URL authentication is very short, it causes playback exceptions.

  • Strict authentication (true): Authentication is not cached. Authentication is performed every time playback starts. This causes playback to fail without a network connection.

Does the Android player SDK support play-while-downloading?

No, it does not. The Android player SDK supports caching and downloading video files during playback when you enable the local cache feature. The next time you play the video, the cached file is played directly. The SDK does not currently support playing a locally cached video file that has been moved from its original file directory.

Does the Android player SDK support getting the buffering speed of a video?

Yes, it does. The Android player SDK supports retrieving the buffering speed, real-time rendering frame rate, audio and video bitrates, and network download bitrate. For more information, see Get playback information.

Abnormal HDR video playback

The Android player SDK does not currently support HDR videos that have rotation angles. Playback errors may occur for these types of videos.

If a video is transcoded into multiple definitions, which definition does the player SDK play by default?

The default playback order for video definitions is: FD, LD, SD, HD, 2K, 4K, OD. For more information about these definitions, see Definition. The player SDK searches the definitions in this order and plays the video in the first available definition.

How to specify the default playback definition

The following code provides an example:

// The VidSts playback method is used as an example.
VidSts vidSts = new VidSts();
// The code for setting parameters such as vid, AccessKeyId, AccessKeySecret, and token is omitted. For more information, see the player creation settings in the Basic Features topic.
/*
    Parameter 1: The desired playback definition. Valid values: FD, LD, SD, HD, 2K, 4K, and OD.
    Parameter 2: Specifies whether to enforce playback of the desired definition. false: Does not enforce playback of the desired definition. The player SDK searches for a definition to play based on the default order. true: Enforces playback of the desired definition. If the desired definition is not found, the video is not played.
*/
vidSts.setQuality("",false);

If a definition has multiple streams, which stream does the player SDK play?

If a definition has multiple streams, the player SDK plays the latest stream.

Other issues

How to play a video without a watermark but download it with a watermark

Transcode the video into multiple definitions. Play the definition without a watermark and download the definition with a watermark.

How to get issue logs

When you request technical support from Alibaba Cloud, you can submit your issue logs to help us resolve your problem more efficiently. You can retrieve the issue logs as follows:

  1. Retrieve the issue logs.

    We recommend that you set the log level to AF_LOG_LEVEL_TRACE before you retrieve the issue logs. For more information, see Get SDK logs.

  2. Provide the generated logs to Alibaba Cloud technical support.