Media asset upload FAQ

Updated at:
Copy as MD

This topic describes common issues with media asset uploads and their solutions.

File stuck in uploading state

This can be caused by one of the following reasons:

  • Cause 1: URL-based upload is an asynchronous process and does not guarantee timely completion.

    The URL-based upload method is asynchronous and does not guarantee timely completion. Uploads may take several hours or even days to complete. This method is available only in the China (Shanghai), China (Beijing), China (Shenzhen), Singapore, and US (Silicon Valley) regions. We recommend that you integrate the ApsaraVideo VOD server-side upload SDK for uploads.

  • Cause 2: You only generated an upload credential without uploading the file.

    Calling the CreateUploadVideo API only obtains an upload credential and creates basic media asset information. It does not upload the actual file. You still need to call OSS operations to complete the file upload. For the complete procedure, see Upload media files by calling the ApsaraVideo VOD API.

  • Cause 3: The upload is slow because the file is large.

    Check if the upload duration is reasonable for the file size. By default, methods such as using the console, upload SDKs, and client tools use multipart upload, which supports single files up to 48.8 TB. The upload SDK also provides a simple upload feature, which supports single files up to 5 GB.

  • Cause 4: Network issues.

    Verify that your network bandwidth meets the requirements.

iOS SDK upload fails with NSCocoaErrorDomain error

This error, with error code 207 and the message 'Error Domain=NSCocoaErrorDomain', typically indicates a file read error caused by insufficient permissions. You can resolve this issue in one of the following ways:

  • Method 1: Grant the upload SDK for iOS permission to read local resources.

  • Method 2: Place the local resources in the sandbox directory before you start the upload.

URL-based upload: "not open in current region" error

The error message The service is not open in current region indicates that URL-based upload is not supported in the current region. This feature is available in limited regions, including China (Shanghai) and Singapore.

If you are in an unsupported region, download the files locally and then upload them by using an upload SDK. For more information, see Upload SDK overview.

Cannot view uploaded images in the console

Images uploaded with the type set to cover are treated as video covers and are not displayed in the ApsaraVideo VOD console. They can only be retrieved by calling an API. For more information, see CreateUploadImage.

JavaScript SDK upload compatibility issue in WeChat

This issue is caused by a compatibility problem with the HTML5 implementation in the WeChat browser. To resolve this, remove the multiple="" parameter from the <input type="file" name="file" id="files" multiple=""> tag.

Stretched preview with the stream ingest SDK

When you select 480p as the stream resolution in the stream ingest SDK, the preview page may appear stretched, but the actual stream output is normal. This happens because 480p corresponds to a resolution of 480×640 pixels. Because this aspect ratio is not supported by most mobile phone screens, the preview appears stretched.

Solution: Modify the aspect ratio of the SurfaceView on the preview page. Update your activity_push.xml file as follows.

public void initView() {
    mPreviewView = (SurfaceView) findViewById(R.id.preview_view);
    mPreviewView.getHolder().addCallback(mCallback);
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <SurfaceView
            android:id="@+id/preview_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

    <!--FrameLayout-->
        <!--android:id="@+id/publisher_fragment"-->
        <!--android:layout_width="match_parent"-->
        <!--android:layout_height="match_parent"-->
        <!--android:visibility="gone"/>-->

    <android.support.v4.view.ViewPager
            android:id="@+id/tv_pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            >
    </android.support.v4.view.ViewPager>
</RelativeLayout>

View and import AAR packages in Android Studio

To view the data in an AAR package, change the file extension from .aar to .zip and then decompress the file. You can then view its contents, such as .class files, .xml files, .jar files, images, and text files.

To import an AAR package:

  1. Copy the .aar file to your project directory, which is typically projectName/libs/, and then reload the project. Copy library files such as AlivcPlayer.aar, aliyun-vod-upload-android-sdk-1.1.1.jar, aliyun-vod-croe-android-sdk-1.2.1.jar, gson-2.8.0.jar, and jsr305-3.0.0.jar to the app > libs directory of your project. After you copy the files, reload the project.

  2. In your build.gradle file, add the local repository path under the root tag and add the compilation dependencies.

    The dirs value must match the directory where you placed the package. For the compile dependency, set name to the AAR filename (without the extension) and ext to 'aar'.

    repositories{
        flatDir{
            dirs 'libs'
        }
    }
    
    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:26+'
        compile 'com.android.support:design:26+'
        compile (name:'AlivcPlayer',ext:'aar')
        // The upload SDK depends on the OSS upload SDK.
        compile 'com.aliyun.dpa:oss-android-sdk:2.4.5'
    }
  3. Select Build > Rebuild to rebuild the project.

    After the build is complete, the imported AAR package appears in the External Libraries section of your project.

    External Libraries
    ├── Android API 26 Platform
    ├── JRE 1.8
    ├── AlivcPlayer:@aar
    │   ├── classes.jar (library root)
    │   │   └── com
    │   │       ├── alivc.player
    │   │       └── aliyun.aliyunplayer
    │   └── res (library root)
    │       ├── values
    │       └── values-zh-rCN
    ├── com.aliyun.dpa:oss-android-sdk-2.4.5
    ├── com.android.support:animated-vector-drawable:26.0.0-alpha1
    ├── com.android.support:appcompat-v7:26.0.0-alpha1
    ├── com.android.support:design:26.0.0-alpha1
    ├── com.android.support:recyclerview-v7:26.0.0-alpha1
    ├── com.android.support:support-annotations:26.0.0-alpha1
    └── com.android.support:support-compat:26.0.0-alpha1

Related links

For detailed upload procedures, see the following topics:

  • For information about how to upload files by using the ApsaraVideo VOD console or PC-based upload tools, see Upload by using GUI tools.

  • For information about how to upload files by using methods such as the ApsaraVideo VOD upload SDK, a native OSS SDK, URL-based upload, or OSS API operations, see Upload by using developer tools.