Revision Record

Version recordeer date judges Review Content
1.0 吴刚 2019/1

[TOC]

1 Overview

1.1 Background

The traditional Airplay protocol must rely on the multicast protocol for service publishing and service discovery. However, in many applications, broadcast and multicast protocols are strictly prohibited by the router device, which limits the use of the Airplay projection protocol.

This document is used to guide the development of the IOS sender using the BTS network AirplayProxySDK. The SDK can be used with the AirplayProxyReciverSDK of the BiJie to implement the Airplay receiver function. The SDK can break through the above network restrictions.

1.2 Reader

Developers and testers who use this development kit for development。

1.3 Definition of abbreviations

abbreviations
Airplay AirPlay is a proprietary protocol stack/suite developed by Apple Inc. that allows wireless streaming between devices of audio, video, device screens, and photos, together with related metadata

2 Range

2.1 SDK description

The overall framework is divided into two layers

  • SDK layer:BJAirplayProxySDK.framework,it is a framework on IOS,provideing the function of the Airplay local agent release.
  • Application layer :Specific APP application parts developed, implemented by the customer based on BJAirplayProxySDK.framework .Our company delivers DEMO APP for reference.

2.2 SDK delivery

  • BJAirplayProxySDK.frameworkis an IOS module with minimum support for IOS8.0
  • DEMO APP source code,BJJDAirPlayDemo is based on BJAirplayProxySDK.framework,provided to the customer as a reference.
  • SDK interface documentation

3 Interface

Applications want to use SDK,First, need to import BJAirplayProxySDK.framework in the project and include the following header files.

#import <BJAirplayProxySDK/BJAirplayProxySDK.h>

The following is the interface definition:

@interface BJAirplayProxyOCConfiger : NSObject

//receiver IP address

@property (nonatomic, copy) NSString *renderIpAddress;  

//The name of the receiver displayed locally on the IPHONE phone(for example, when the Dingding is put on the screen, it is named Dingding, and the default value in DEMO is JD). 

@property (nonatomic, copy) NSString *airPlayDeviceName;

@end

@interface BJAirplayProxyOCInterface : NSObject

//Update configuration parameters

+(void)startConfig:(BJAirplayProxyOCConfiger *)configer;

//Initialize SDK

+(BOOL)initializeSDK:(BJAirplayProxyOCConfiger *)configer;

//uninit SDK

+(void)uninitSDK;

//Start Local Screen Proxy Session

+(BOOL)startAirplayProxy;

//End Local Screen Proxy Session

+(void)stopAirplayProxy;

@end

3.1 BJAirplayProxyOCConfiger class description

BJAirplayProxyOCConfigerclass defines the parameters that SDK can configure.

renderIpAddress is String type,it is the receiver IP address that runs the BJAirplayProxyReceiver.

airPlayDeviceName is String type,it is the name displayed locally after the Airplay agent is started locally. For example, demo is displayed as BiJie ScreenCast by default, customers can define it according to the actual needs.

3.2 BJAirplayProxyOCInterface classdescription.

BJAirplayProxyOCInterface defines the operation interface of SDK.

3.2.1 Initialize SDK

+(BOOL)initializeSDK:(BJAirplayProxyOCConfiger *)configer

InputBJAirplayProxyOCConfiger target

Return:Initialization success Return YES

​ Initialization fail Return NO,There is currently no initialization failure scenario.

Description:Initialize SDK

3.2.2 Deinitialize SDK

+(void)uninitSDK

Inputnull

Returnnull

Description:deinitialize SDK,will stop the local Airplay service release. Called when the APP exits or the shot module exits.

3.2.3 Publish a local Airplay agent

+(BOOL)startAirplayProxy

Inputnull

ReturnYES: release success NO: release fail

Description:The interface is called when a screen process is required to be initiated,after the interface is called,a receiver named airPlayDeviceName in the BJAirplayProxyOCConfiger object is found on the screen mirror of the iphone. Then Airplay screen cast is available . Note: You must have called initializeSDK or call startConfig to update the correct configuration information before calling the interface.

3.2.4 End local Airplay agent.

+(void)stopAirplayProxy

Inputnull

Returnnull

Description:call the interface to end the screen cast

3.2.5 Update configuration information

+(void)startConfig:(BJAirplayProxyOCConfiger *)configer

InputBJAirplayProxyOCConfiger target

Returnnull

Description:When updating the receiving IP information or name, the user creates a new Configer object and invokes the interface to update the configuration. Updating the configuration requires calling startAirplayProxy before it takes effect.

4 Typical process

The following Description uses a typical process for this SDK, assuming that the SDK is used to implement a similar function like Dingding projection, and the typical interaction process is as follows.

4.1 Initiate a splash screen process

  1. Receiver device carries the information of the IP address and the like to the management platform implemented by the client.
  2. Type the code on the screen in the IOS sender , according to the IP address of the receiving device, refer to the IP address of receiver on the management platform implemented by the customer. This IP address is the renderIpAddress that needs to be filled in the BJAirplayProxyOCConfiger
  3. Call startAirplayProxy to enable local Airplay proxy,the receiver can then be found on the mirror screen of iphone, then start screencast, the receiver can receive the Airplay projection session. At this time, the receiver reports that the sender of the platform has been out of the screen state, and the sender updates the interface status.

4.2 End-of-screen process

Suppose the user uses the Airplay end mirror function in the IOS phone to end the screencast.

  1. The receiving end will receive the notification event at the end of the screen. At this time, it is required to report to the platform and the session has ended.
  2. The platform push end notification informs the IOS transmitter that the projection session is over,At this point, the IOS sender APP calls stopAirplayProxy to end the local proxy and update the UI status.

Suppose that the user uses the end screen function in the APP to end the screencast

  1. IOS sender APP calls stopAirplay Proxy to stop the local proxy service.
  2. IOS launch terminal APP notifies the management platform to end the screen,the management platform pushes the notification of end the current projection to the receiver to end the airplay session,Airplay receiver end the session. IOS sender update the UI status.