百度智能云

All Product Document

          Multimedia Cloud Processing

          SDK Integration

          Development and Running Environment

          • Android Studio
          • Support systems of Android Version 2.3 and above; support armv5/armv7a/arm64/x86/x86_64 and virtual machine operation.

          Download the Latest SDK and Extract

          Download the latest player Android SDK,The files directories after extraction are as follows:

          ├── Baidu-Cloud-Player-Android-<Version>-<Revision> 
          │   ├── bdplayer-sample 
          │   ├── BDCloudVideoView_sourcecode 
          │   ├── javadoc 
          │   ├── libs 
          │   │   ├── armeabi 
          │   │   ├── armeabi-v7a 
          │   │   ├── arm64-v8a 
          │   │   ├── x86 
          │   │   ├── x86_64 
          │   │   └── bdplayer.jar 

          Among them,

          • Example that bdplayer-sample is demo;
          • BDCloudVideoView_sourcecode is the java source code for BDCloudVideoView control;
          • javadoc is the list of Java API interface;
          • libs is so file and jar package. ·

          Apply for AK

          Apply for an account and enable the privileges: You need to log in Baidu AI Cloud console, and get Access Key (AK) in Security Certificate Page. The AK parameter must be passed in during SDK authentication.

          Configuration Project

          Through the following steps, add jar pack and so library to the project.

          Configure jar package

          Copy bdplayer.jar to directory app/libs of your project, mark the path of jar package in the dependencies module of gradle file, as shown in the following:

          dependencies { 
              compile files('libs/bdplayer.jar') 
              compile files('libs/video_cache.jar') 
          } 

          Configure so library

          Copy the so library folders of armeabi``armeabi-v7a to app/src/main/jniLibs directory.

          Configure BDCloudVideoView controls

          SDK provides BDCloudMediaPlayer class by default, and if you want to use BDCloudVideoView control, you need to copy the code under the directory of BDCloudVideoView_sourcecodein the decompression package toapp/src/main/java`.

          Configuration completed

          After the configuration is completed, the directory is shown as follows:

          ├── bdplayer-sample 
          │   ├── app 
          │   │   ├── libs 
          │   │   │   └── bdplayer.jar //Location of jar package 
          │   │   │   └── video_cache.jar 
          │   │   ├── src 
          │   │   │   ├── main 
          │   │   │   │   ├── java 
          │   │   │   │   │   └── com.baidu.cloud.videoplayer.widget //BDCloudVideoView location 
          │   │   │   │   ├── jniLibs 
          │   │   │   │   │   ├── armeabi-v7a // Location of so library file 
          │   │   │   │   │   └── arm64-v8a 

          Note

          • If you also use other so libraries, please make sure that the number of so files under each CPU architecture is exactly the same. For example, the number of so files in the ‘armeabi-v7a and ‘x86 (if any) folders is exactly the same. As the installer will only copy the folder contents of corresponding CPU architecture to the directory of /data/data/com.your.package/lib during the installation of Apk in mobile phone, and if there is no primary CPU architecture folder in mobile phone, the installer will copy the folder contents of secondary CPU architecture (the secondary CUP architecture of most mobile phones are armeabi-v7a, and the simulator does not have a secondary CPU architecture in general). Baidu Player supports full-architecture so libraries. If other so libraries only support a limited number of architectures, please take the intersection of so library architectures of all SDKs.
          • The directory of app/src/main/jniLibs is the default so packaging path of Android Studio. If you are accustomed to placing so files under the directory app/libs, you need to configure jniLibs.srcDirs = ['libs'] additionally under gradle file.

          Claim the privileges needed by SDK

          Add the following privilege to your ndroidManifest.xml,

          <uses-permission android:name="android.permission.INTERNET" /> 
          <uses-permission android:name="android.permission.WAKE_LOCK" /> 
          <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
          <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
          <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 

          Anti-obfuscation settings

          Add the following statements to your proguard obfuscation configuration file,

          -libraryjars libs/bdplayer.jar 
          -keep class com.baidu.cloud.media.**{ *;}
          Previous
          Android-Player-SDK-Introduction
          Next
          Quick Advancement