China Delivery with the Native SDKs

In this topic, you will learn how to use the Brightcove Native SDKs to deliver video to China from outside the country.

Introduction

Brightcove provides a solution for delivering video to China from outside the country. The solution is comprised of two parts:

  • A proxy server hosted within China
  • A connected China-specific CDN

The proxy routes non-video traffic (Playback API requests, Analytics beacons, and the web player itself) to and from viewers in China to Brightcove infrastructure located outside.

The CDN is connected to the proxy and handles the video and image content.

Requirements

The following requirements are needed for China Delivery with the Brightcove Native SDKs:

Setup

Device OS version

  • The current SDK requires iOS 12.0 or newer for manual XCFramework or CocoaPods installations, or iOS 14.0 or newer with Swift Package Manager. See the SDK overview for installation requirements.

Brightcove SDK version

  • The Android Native SDK is not supported
  • Native SDK for iOS 6.5.0 and newer

iOS Implementation

The BCOVGlobalConfiguration class allows you to set custom configurations for the Native SDK for iOS.

Within this class, set the chinaProxyDomain property to a custom, fully qualified domain name (FQDN) for the Playback API, metrics and analytics collection services.

@property (nonatomic, copy, nullable) NSString *chinaProxyDomain;

To use China Delivery, follow these steps

Swift

  1. Review the VideoCloudBasicPlayer sample.

  2. In ViewController.swift, set chinaProxyDomain inside the initializer closure for sharedSDKManager, before calling sharedManager(). Configure the domain before creating any playback controllers or playback services:

    import UIKit
    import BrightcovePlayerSDK
    
    class ViewController: UIViewController {
      let sharedSDKManager: BCOVPlayerSDKManager = {
        BCOVGlobalConfiguration.sharedConfig.chinaProxyDomain = "your host domain"
        return BCOVPlayerSDKManager.sharedManager()
      }()
    }

Objective-C

  1. Review the Objective-C simple video app tutorial.

  2. In ViewController.m, set chinaProxyDomain before calling setup, which creates the SDK objects:

    - (instancetype)initWithCoder:(NSCoder *)coder
    {
      self = [super initWithCoder:coder];
      if (self)
      {
          BCOVGlobalConfiguration.sharedConfig.chinaProxyDomain = @"your host domain";
          [self setup];
      }
      return self;
    }

Custom players

To support Brightcove China Delivery with a custom player, you must update how it connects to Brightcove from within China Delivery.

The Playback API endpoint hostname must be changed from edge.api.brightcove.com to yourdomain.cn. Here is an example:

The following endpoint:

https://edge.api.brightcove.com/playback/v1/accounts/123450001/videos/543210001

Would become:

https://videos.yourdomain.cn/playback/v1/accounts/123450001/videos/543210001

The Data Collection API hostname must be changed from metrics.brightcove.com to yourdomain.cn. Here is an example:

The following endpoint:

https://metrics.brightcove.com/v2/tracker?event=video_view&domain=videocloud&account=123&video=789

Would become:

https://videos.yourdomain.cn/v2/tracker?event=video_view&domain=videocloud&account=123&video=789

In the examples shown above videos.yourdomain.cn is the ICP-licensed and active hostname configured for the China Delivery account.

Limitations

For details about the limitations for this feature, see the Overview: China Delivery document.