Review Record

Version Recorder Date Judges Contents
1.0 吴刚 2019/1

Filing Approval

Version Approver Date Approval confirmation

[TOC]

1 Overview

1.1 Outputground and aim

This paper is used to guide the use of MAC platform BJCast SDK to develop the sender, and the SDK can be used to develop the screen application with the BJCast receiver of the network.

1.2 Targets

This document is suitable for developers and testers who implement launcher programs on the MAC side

1.3 Abbreviations definition

Abbreviations
BJCast Wireless projection protocol developed by BiJie

2 Scope

2.1 SDK description

The overall framework is divided into two layers

  • SDK layer: BJCastMacSDK.framework and BJMacLive.framework, which is a MAC platform framework that provides the functions of wireless display
  • Application layer: The specific APP application part of the development is implemented by the customer based on BJCastMacSDK.framework and BJMacLive.framework. Our company delivers DEMO APP, which customers can refer to.

2.2 SDK Deliverable

  • BJCastMacSDK.framework is an MacOS module which support BJCast
  • BJMacLive.framework is an MacOS module which support media functions
  • DEMO APP source code, based on BJCastMacSDK.framework and BJMacLive.framework, provided as a reference implementation to customers
  • SDK Interface document

3 interface

The application needs to use the SDK. First, you need to import BJCastMacSDK.framework and BJMacLive.framework in the project and include the following header files.

#import <BJCastMacSDK/BJCastMacSDK.h>

#import <BJMacLive/BJMacLive.h>

3.1 Basic data structure description

3.1.1 BJCastOCInterface Class description

@interface BJCastOCInterface: NSObject
@property (nonatomic, copy) NSString *ipAddress;
@property (nonatomic, copy) NSString *password;
@property (nonatomic, copy) NSString *deviceName;
@property (nonatomic, assign) int32_t port;
@property (nonatomic, assign) BJCastTransferType videoTransferType;//defaultTCP
@property (nonatomic, assign) BJCastTransferType audioTransferType;//defaultTCP
@property (nonatomic)BJSessionPLayMode sessionPlayMode; 

The BJlibeventOCConfiger class defines information about initiating a BJCast screencast session.

ipAddress: Receiver IP address.

Password: Screening password, the current version does not support password (can be ignored)
deviceName: The name of the transmitting device, which can be used to display on the receiving end.
Port: Receiver BJCast service port, the default is 8190.
videoTransferType: The transmission mode of the video. The value is TCP or UDP. The default is TCP.
audioTransferType: The transmission mode of the video. The value is TCP or UDP. The default is TCP.

3.1.2 BJSessionConfig Class description

BJSessionConfig is used to set the parameters of the current recording screen.

typedef enum : NSUInteger {
    BJSessionPresent1080P,
    BJSessionPresent720P,
} BJSessionPresentType;

@interface BJSessionConfig : NSObject

@property (nonatomic)BJSessionPresentType sessionPresentType;

@end

Where sessionPresentType is the recording screen resolution attribute

3.1.3 BJEncodeConfig Class description

typedef enum : NSUInteger {
    BJEncodeEncode1080P,
    BJEncodeEncode720P,
} BJEncodeEncodeType;

typedef enum : NSUInteger {
    BJEncodeFrameRate15,
    BJEncodeFrameRate25,
    BJEncodeFrameRate30,
    BJEncodeFrameRate60,
} BJEncodeFrameRateType;

NS_ASSUME_NONNULL_BEGIN

@interface BJEncodeConfig : NSObject

@property (nonatomic)int fps;

@property (nonatomic)int gop;

@property (nonatomic)int bitRate;

@property (nonatomic)BJEncodeFrameRateType frameRateType;

@property (nonatomic)BJEncodeEncodeType encodeType;

@end

fps: Frame rate

gop: gopsize, Indicates key frame interval

bitrate: code rate in bps

frameRateType:Predefined several frame rates, refer to the definition of BJEncodeFrameRateType

encodeType:The predefined encoding output resolution type, refer to BJEncodeEncodeType, currently supports 720P and 1080P.

3.2 BJMacLiveInterface class description

The BJMacLiveInterface class defines the interface to the SDK.

3.2.1 Initializing the SDK

+(BOOL) initializeSDK:

  • Input: null
  • Output: Initialization Outputs YES
    Initialization failure Outputs NO, the current no initialization failure scenario
  • Description: Initialize the SDK

3.2.2 Deinitializing the SDK

+(voiod)uninitSDK;

  • Input: null
  • Output: no
  • Description: Go to uninitialize the SDK.

3.2.3 Creating a Screening Session

+(void)createSession

  • Input: none
  • Output: no
  • Description: Start wireless screencast
  • Note: You must have already called setupConfigByIp or updateConfig to update the correct receiver information before calling this interface.

3.2.4 Ending the screencast session

+(void)destroySession;

Description: End the screencast session

3.2.5 Setting Receiver Information

+(void)setupConfigByIp:(NSString *)ip

                  port:(NSNumber *)port

              password:(NSString *)password;
  • Input:
    • iP: Receiver IP address
    • port: Receiver service port
    • password: Receiver screencast password (current SDK version does not support password cast)
  • Output: null
  • Description:

    Set the information such as the IP address of the receiving end of this screen, and the content of the setting is a subset of the updateConfig interface.

3.2.6 Set up screencast session information

+(void)updateConfig:(BJlibeventOCConfiger *)configer;

  • Input:configer,For a detailed description of the configuration, please refer to 3.1.1
  • Output:null
  • Description:Set the session information of the screen, including the receiving end information and transmission mode, etc.

3.2.7 Setting Screening Session Information

+(BJEncodeConfig *)settingEncodeConfig;

  • input: null
  • Output: get the current Encode configuration object
  • NOTE: You can use this method to obtain the current video encoding configuration object and set the properties of the configuration object directly. For the parameter meaning, refer to 3.1.3.

3.2.8 Setting the Recording Parameter Information

+(BJSessionConfig *)settingSessionConfig;

  • Input: none
  • Output: Get the current recording configuration object BJSessionConfig
  • NOTE: You can use this method to obtain the current screen recording configuration object and directly set the properties of the configuration object. For the parameter meaning, refer to 3.1.2.

3.2.9 Obtaining a List of Screen Device Information

+(NSMutableArray *)getDevicesInfoArray;

  • Input: none
  • Output: NSMutableArray *
  • Description: Get the current screen device information list

3.2.10 Get a screen name

+( NSString *) getScreenDeviceName :(NSDictionary *)dict;;

  • Input: None, (NSDictionary *) dict
  • Outputs: NSString *
  • Description: Get the current screen name. Combine getDevicesInfoArray to get the video output device

3.2.11 Full screen

+( void) setFullScreen :(BOOL)fullScreen;

  • Input: (BOOL)fullScreen
  • Outputs: none
  • Description: notice the receiver that let me fullcscreen while there are more that one sources

4 Service Discovery Protocol

When the transmitting end initiates the screening session to the receiving end, it is first necessary to determine the communication IP and communication port of the receiving end. The discovery protocol is used to automatically discover the receiving device at the wireless projection system.
Customers should choose a screencasting agreement according to the needs of their business systems. If the customer needs to manage the receiving device through the cloud platform, then the custom wireless projection protocol should be considered.
Currently, the BJCast receiver uses the zeroconf method to implement service publishing and service discovery based on mdns.
Customers can use the standard ns-sd interface to discover services.
ServiceName: BJCastReceiver@Name@DeviceID, ServiceName is divided into 3 segments, each segment is separated by @ , the first segment is fixed as BJCastReceiver, the second segment is the receiving end name (used to describe the receiving end), and the third segment is the device ID. (Used to uniquely identify a device, currently defaults to the MAC address of the receiving end).
ServiceType: "_ bjcast2._tcp"
The IOS/MAC platform can implement service discovery using the Bonjour related API interface.

5 Typical process

The following describes a typical process for using this SDK. It is assumed that the SDK is used to implement a similar nailing function. The typical interaction process is as follows.

5.1 Initiating the projection process

  1. The receiving device carries its IP address and other information to the client-implemented management platform for registration. The management platform assigns a unique screencast code, and the device interface displays the screencast code.
  2. The screencast code displayed on the mac transmitter software input device is queried according to the screencast code to the client-implemented management platform to query the IP address of the receiver device. This IP address is the ip that needs to be filled in setupConfigByIp.
  3. Call createSession to start wireless screencast

5.2 Ending the projection process

  1. Call destroySession to stop wireless screencast