All Products
Document Center

Video playback

Last Updated: Aug 01, 2019

Instant loading solution

SmartVideo uses the full-screen instant loading solution to play videos. For more information, see Use ApsaraVideo Player to quickly implement full-screen instant loading.

Quickly integrate the instant loading solution


Currently, the video playback module is highly coupled with the video production and upload module. The video recording module and video editing module share the same navigation code. If you want to integrate the video playback module without complex code modification, you need to integrate at least the video editing module and video production and upload module in advance.

Step 1: Copy SDK files

The video playback module of SmartVideo is dependent on the player SDK. The following table lists the dependent SDK files.

Name Type Description
AliThirdparty.framework DLL The dependent third-party library of the player SDK.
AliyunLanguageSource.bundle Resource bundle The resources required by the player SDK.
AliyunVodPlayerSDK.framework DLL The advanced ApsaraVideo Player.
AliyunPlayerSDK.framework DLL The basic ApsaraVideo Player.

Copy the three framework files and the resource bundle file highlighted in red into your project, as shown in the following figure.
Copy files for VOD playback

Step 2: Copy business code files

  • Copy the files highlighted in red into your project, as shown in the following figure.
    Copy business code files for VOD playback

Step 3: Configure the PCH file

Add the following reference to a .pch file in your project:

  1. #import "AlivcDefine.h"
  2. #import "AlivcImage.h"
  3. #import "AlivcMacro.h"
  • If your project does not contain a .pch file, you can copy the PrefixHeader.pch file from the demo. Keep the preceding reference in the .pch file and choose TARGETS > Build Settings to configure the PCH file, as shown in the following figure.

Prefix Header: Enter the directory of the PrefixHeader.pch file in your project, for example, $(SRCROOT)/Your own directory/PrefixHeader.pch.

Step 4: Set up the project environment

  • Open the project and select the target. Choose General > Embedded Binaries. Click + to import the AliyunVodPlayerSDK.framework, AliyunPlayerSDK.framework, and AliThirdparty.framework files, as shown in the following figures.

 undefined  VOD playback framework

Step 5: Use the video playback feature

Configure a root view controller in the AppDelegate.m file. The sample code is as follows:

  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  2. // Overrides the point for customization after the application is published.
  3. // Initializes a root view controller.
  4. self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
  5. [AlivcImage setImageBundleName:@"AlivcShortVideoImage"];
  6. UIViewController *vc_root = [[NSClassFromString(@"AlivcShortVideoQuHomeTabBarController") alloc]init];
  7. UINavigationController *nav_root = [[UINavigationController alloc]initWithRootViewController:vc_root];
  8. self.window.rootViewController = nav_root;
  9. [self.window makeKeyAndVisible];
  10. return YES;
  11. }