Revision record

Version recorder date judges Review content
0.9 吴刚 2018 first draft
1.0 方一鸣 2018 Update how SDK is imported
1.1 吴刚 2019.3.13 Callback interface for updating audio and video dataAdded BJCastV2 release note. Description of new service release and service discovery


1 Overview

1.1 Aim

It is used to guide the development and testing of the developers who use the Bijie BJCast receiver SDK.

1.2 Target

This document is applicable to developers who develop the BJCast receiving end of the Android platform.

1.3 Abbreviations definition

abbreviations definition
BJCast BiJie wireless screen cast protocol

2 Scope

2.1 Function

This SDK can accept a screen request form Mac , Windows , and Android.

All four emitters use BJCast projection protocol. BJCast protocol is currently divided into BJCastV1, BJCastV2 versions.

Windows/Android sender uses BJCastV1, Mac sender uses BJCastV2.

The external interface of BJCastV1 and BJCastV2 at the receiver is consistent.

2.2 SDK frame

BJCast Receiver SDK is generally divided into two layers.

1) cast_base_lib-1.0.17-release.aar:it is an Android Module,it defines the basic interface of MediaChannel,Module.

2) bj_cast_lib-1.0.18-release.aar: it is an Android Module,which defines BJCastModule,and related JNI interface.

App is developed based on bj_cast_lib-1.0.18-release.aar. Applications should not, in principle, modify what is in cast_base_lib-1.0.17-release.aar, bj_cast_lib-1.0.18-release.aar.


The above figure is the core class diagram,customers need to implement the ModuleImpItf interface and the functional interface of the MediaChannel.

2.3 The DAMO use of DSK

BJCastReceiverSDKDemo is a reference implementation of receiver,which is based on bj_cast_lib-1.0.15-release.aar, and realizes function of BJCast receiver. In which BJCastModuleImp realizes ModuleImpItf interface,GLScreenRenderChannel realizes MediaChannelinterface.

2.4 SDK delivery

  • Dynamic depot
  • DEMO source code
  • SDK interface document

3 Interface

3.1 Description

Interfaces are mainly in BJCastModule and MediaChannel.Users can implement their own related interfaces, You can also refer to the DEMO source code implementation provided by our company.

3.2 Set up a custom implementation class interface

public void setImp(ModuleImpItf imp)

3.3 Initialization interface

public native boolean init(Properties props);

In which name means the name of receiver,The name that searched by BJCast sender is passed through this parameter; pwd is the password to be inputted when beginning screen casting , can be null.

BJCastModule calss Init way to Initialize the BJCast receiver module. Called when App is initializing,The BJCastModule object should be designed to be only one.

Where Properties supports the setting of the following properties:

PARA_NAME_DEVICE_NAME:the name of receiver, also the name searched by the discovery protocol(If the customer does not need to use our discovery protocol,they may not have to care about this attribute)。

PARA_NAME_SERVICE_PORTBJCastV1 service interface,BJCastV1 service interface default is 8188BJCastV2 service interface is BJCastV1 service interface +2,default is 8190. User can set it.

PARA_NAME_MDNS_DEAMON_ENABLE:Whether internal MDNSD is enabled to publish Airplay services,value rang is 0,1. The default is 1.

Notice:If the receiver runs BJAirplay and BJCast at the same time,then need to set PARA_NAME_MDNS_DEAMON_ENABLE to 1 in one of the modules, and the other must be 0;If both modules initialize, the parameter is 1,it will lead to one of the two release fail.

3.4 Deinitialize the interface

public native void fini();

Use BJCastModule class’s fini way to deinitialize BJCast module. Called when App destroys the BJCast receiver service.

3.5 Session access interface

public MediaChannel reqMediaChannel(MediaChannelInfo info) ;

Iput:session information,describe its business type.

Output: The MediaChannel object that be created.

This is a callback interface, when the BJCast protocol stack finds session access, JNI lay will call this interface actively,the application layer needs to implement the relevant logic,customer need to implement this logic in the customer’s own ModuleItf implementation class.

Specific implementation can refer to DEMO source code.

3.6 Session end interface

public void relMediaChannel(MediaChannel channel)

Call back interface, called when the underlying receiving session ends. Realize related logic in Application layer.

Specific implementation can refer to DEMO source code.

3.7 Application layer end interface.

public void kickOut(MediaChannel channel)

The application layer actively ends the session interface.

3.8 Session processing interface

When the session is established successfully,The protocol stack calls the corresponding interface in the MediaChannel class to spit back data or get the status. The following interfaces need to be implemented in the MediaChannel subclass,customers need to implement the following interfaces according to their own actual situation.

Important interfaces in MediaChannel subclass are as follows, the BJCast receiver needs to focus on the following interfaces.

3.8.1 Set window handle

public void setSurface(Surface surface)

​ Configure a window handle for render output.

3.8.2 Audio data return interface

public abstract void onAudioFrame(byte[] buffer,int len,long ts);

Where buffer is an array of audio data. ,len is the length of data,ts is a timestamp。

JNI return audio data, Audio is AAC encoded data, Users need to implement audio decoding and play in this function. DEMO source code in SDK can be referred to for specific implementation.

3.8.3 Video data return interface

public void onVideoFrame(byte[] buffer,int len,long ts)

​ BJCast Mirror Video data Interface,what is returned by this interface is H.264 video data.,user needs to decode and play.

Buffer is an array of video data, len is data length and ts is timestamp. The specific implementation can refer to the DEMO source code in SDK.

3.8.4 Notify mouse shape interface

public void updateCursorShape(byte[] pngData)

When the shape of the mouse changes, the new mouse shape interface is notified and the input is PNG data. The PNG data can be decoded as a Bitmap with reference to the implementation in demo.

BJCast uses a separate channel to transmit mouse information, and the maximum frame rate of the mouse can reach 100fps.

3.8.5 Mouse location update notification interface

public void updateCursorPos(short x,short y)

the interface informs the update of the mouse position x, y, The upper-left coordinates of the screen are (0,0). Note that the player needs to convert coordinates based on the actual image size and the current screen size. For example, the video image transmitted by the transmitter is 720p,coordinate position (1280,720), the view corresponding to the currently displayed player is 1080p screen, it is obvious that the actual display position needs to be converted to (1920, 1080), which can be converted by referring to the actual position calculation method in demo.

3.8.6 Hide the mouse notification interface

public void hindCursor()

The interface notifies the application that it needs to hide the mouse (for example, when the sender plays the video with the full screen , the mouse automatically disappears, and the receiver is notified to hide the mouse)

4 Service discovery

When the sender initiates the projection session to the receiver, it is first necessary to determine the communication IP and communication port at the receiver. The discovery protocol is used to automatically discover the receiver device in the wireless screen shooting system. Customers should choose the projection protocol according to the needs of their own business system. If the customer needs to manage the receiver device through the cloud platform, it is necessary to consider the custom wireless screen shooting protocol. At present, two kinds of discovery protocols are predefined in BJCast SDK, which can be used to discover BJCast receiver in the same LAN. The BJCastV1 supports the discovery of the service discovery and the Zerosponf by the discovery protocol ; and the BJCastV2 uniformly uses the Zerocarf to realize the service release and service discovery.

4.1 BJCastV1 custom service discovery protocol

SDK internally supports a custom service discovery protocol, such as the WINDOWS/Android launcher SDK, which already provides an interface, which is not detailed here.

4.2 Zeroconf

At present, the BJCast receiver uses zeroconf to realize service publishing and service discovery based on mdns.

Customers can use the standard ns-sd interface to discover services.

4.2.1 BJCastV1 service release

ServiceName: BJCastReceiver@Name@DeviceID, ServiceName is divided into three parts,each part is separated by the @ symbol,the first is BJCastReceiver,the second is receiver name,the third is device ID(used to uniquely identify a device that currently acquires the MAC address of the receiver by default)

ServiceType: “_bjcast._tcp”

4.2.2 BJCastV2 service release

ServiceName: BJCastReceiver@Name@DeviceID, ServiceName is divided into tree parts,each part is separated by the @ symbol,the first is BJCastReceiver,the second is receiver name,the third is device ID(used to uniquely identify a device that currently acquires the MAC address of the receiver by default)

ServiceType: “_ bjcast2._tcp”

4.2.3 method for realizing zercoonf service discovery

The current Android, IOS/ MAC platform has standard API interfaces to support NSD-based service discovery. Windows can use the Apple open source mDNSResponder to implement service discovery. Android platform can use NsdManager related interface to realize service discovery, can refer to

IOS/MAC platform can use Bonjour related interface to realize service discovery.

The windows platform can use Bonjour related interface to implement the service, and can refer to the windows version of mDNSResponder to realize the service discovery function. Can refer to

5 Demo Description

BJCastModuleImp implements ModuleImpItf interface in Demo,The method of the relay channel is realized , Here you can control whether to access the logical control of a session. Where GLScreenRenderChannel is created in reqMediaChannel,and start the playing related View, create the Surface for playback. The GLSrenRenderChannel implements the MediaChannel-related functional interface and uses the MediaCodec interface to decode and play audio and video data.

6 How to use SDK

  1. Import aar, create a new libs directory in the app directory and place the aar file in that directory,Then add the following code above and inside the dependencies in the build.gralle(app). :repositories{ flatDir { dirs ’libs ’} },compile (name: ‘bjcast_lib-1.0.18-release.aar’, ext: ‘aar’) compile (name: ‘cast_base_lib-1.0.17-release.aar’, ext: ‘aar’),can refer to the Demo
  2. To implement the ModuleImpItf interface, refer to the BJCastModuleImp. reqMediaChannel interface to return an instance of a custom MediaChannel implementation class and start the playback interface.
  3. To implement the MediaChannel-related functional interface, refer to the GLScreenRenderChannel.
  4. To realize its own playback interface, we can refer to the implementation of view in view package, and set the Surface of playback interface to MediaChannel.
Categories: Document of SDK


Cashsef · 2019年11月18日 at am6:50

Free Credit Scores & Credit Reports at

    바카라사이트 · 2019年11月28日 at pm6:32

    My plan is to test how things go without Disqus, and you should too – testing is essential to find what works for you.
    One of the problems with a lot of blog themes is that you have to scroll all of the way to the bottom of the comments to enter your comment.

퍼스트카지노 · 2019年11月28日 at pm6:35

And because one of the keys to getting more comments is to make it easy for your readers to comment, we need to do something to make this easier.
You can do this by linking to your comment form at the end of your post, a good example of this in action is what Noah Kagan does on his blog;

카지노사이트추천 · 2019年11月28日 at pm6:37

In the screenshot above, Noah links to his comment form twice, when you click on one of these links you will immediately be taken to the comment form.
When someone is given too many options, they will take the easiest option; no action.

바카라사이트추천 · 2019年11月28日 at pm6:38

If you aren’t getting many comments on your blog yet, avoid drawing attention to your comment counts.
If you aren’t getting many comments (yet) or you are getting the wrong sort of people commenting on your blog, it’s worth taking a look at who you are really trying to reach.

카지노사이트 · 2020年1月18日 at pm12:09

Yousef O. Barasneh, 22, of Oak Creek, Wisconsin, is alleged to be a member of The Base and has been charged with conspiring to violate citizens’ rights to use property free from threats and intimidation, according to a statement from the US attorney’s office for the Eastern District of Wisconsin.

카지노사이트 · 2020年1月18日 at pm12:11

Brian Lemley, Patrik Mathews, and William Bilbrough, all members of a neo-Nazi group, had their initial appearances before U.S. Magistrate Judge Charles B. Day in U.S. District Court in Greenbelt, Maryland, on Thursday, January 16.

바카라사이트 · 2020年1月18日 at pm12:12

The video, taken from a distance, set social media abuzz. Firstly, because Charlie is clearly a chip off the old block when it comes to golf.

카지노사이트 · 2020年1月18日 at pm12:12

On the one hand, Woods wants his kids — Charlie has an older sister Sam — to have as close as possible to a normal life, such as competing in junior golf tournaments, or going to soccer practice with friends, which the 44-year-old often references in news conferences.

카지노사이트 · 2020年1月18日 at pm12:13

So when one of Woods’ children shows talent at golf, perhaps unsurprisingly given their dad’s 15 majors and status as arguably the best of all time, the spotlight is likely to swing in their direction.

카지노사이트 · 2020年1月18日 at pm12:13

During their early childhood it was relatively easy, and for a number of years recently, Woods was out of the scene himself given his catalogue of back injuries.

Leave a Reply

Your email address will not be published. Required fields are marked *