Teach you how to develop a completely new function of miracast

Time:2020-11-16

Mobile phone and TV are the most common and long-term intelligent devices that accompany us in our life. With the rapid development of mobile terminals and communication technology, mobile phones are endowed with a broader and diversified application ecology. Large screen TV makes up for the visual limitations brought about by the size of the hands by its large vision and shocking video and audio. Nowadays, the demand for extension of mobile phones is becoming more and more prominent. Wireless projection is becoming one of the mainstream ways to watch the content of mobile terminals, and plays an indispensable role in video entertainment, distance education, online office and so on.

By accessing Huawei’s terminal distributed technology cast + kit, Huawei’s mobile phone can be taken as the center, cast + image projection and cast + streaming media projection as carriers to achieve the smooth conversion from small screen of mobile phone to large high-definition screen, bringing users a brand-new experience of large screen viewing, large screen reading and game with 8-fold mirror.

Without much to say, we will directly enter the practical training session of teaching you how to quickly integrate Huawei cast + kit in one week. Follow the strategy below to complete the development easily.

First of all, the interface call process is illustrated——

Teach you how to develop a completely new function of miracast
   in short, the development of access can be roughly divided into six processes. Firstly, we need to declare variables and obtain the instance of playerclient; secondly, when the application is started, we can obtain the instance of playerclient, start the service, register and listen; thirdly, set the relevant content of the screen projection business, including the settings of the projection attribute, the setting of the authentication mode information and the related settings that can be found by the peripheral devices; The fourth is to set up the projection display surface. Here we need to pay attention to the application level. It is required to ensure that screen recording, screen capture and recording are not allowed in the process of screen projection, and the surfaceview is required to set flag_ The last two steps are related to screen projection, that is to start the screen casting, pause the screen casting and disconnect the execution.

Integrated development strategy——

  1. First, create an application project and add the required permissions in Android manifest

Teach you how to develop a completely new function of miracast

  1. Add the AAR file of SDK in the Lib directory, and set the build.gradle Add the dependency of SDK.

Teach you how to develop a completely new function of miracast

  1. Initializing related services and instances

Teach you how to develop a completely new function of miracast

Register callback function:

In onevent of ieventlistener, the sink (device) will report various messages, including initialization service, receiving connection request from the opposite device, authentication success, etc.; ondisplay event is the callback of the mobile phone, and displayinfo is the information on the mobile phone side

Teach you how to develop a completely new function of miracast

  1. After the initialization is successful, build the large screen projection capability. Set the display resolution, display frame number, turn on detected, configure low delay strategy and so on.

Teach you how to develop a completely new function of miracast

Teach you how to develop a completely new function of miracast

  1. If the pin code of the mobile terminal is correctly input or the password is input correctly or the screen is not launched in non password mode for the first time, the event will be reported_ ID_ CONNECT_ Req message, which will carry the projectiondevice information of the mobile device requesting connection.

Teach you how to develop a completely new function of miracast

  1. Event will be reported in pin mode for the first time_ ID_ PIN_ CODE_ Show message, pin code can be downloaded from dislayinfo.getPinCode () obtained.

Teach you how to develop a completely new function of miracast

  1. EVENT_ ID_ CONNECT_ After the req message, the event is reported in sequence_ ID_ DEVICE_ Connected and event_ ID_ Paused message. Under the paused message, the large screen terminal can set the surface and start to play the projection video stream. The premise is that the surface must be effective and receive paused before starting the screen operation, so as to avoid the problem of black screen due to equipment reasons.

Teach you how to develop a completely new function of miracast
Teach you how to develop a completely new function of miracast
   the integration has been completed. Let’s feel the new experience brought by the black technology Huawei cast + enhanced projection technology.
First of all, Huawei cast + kit adopts a system level connection entrance, which is easy to operate. Select “wireless screen projection” in the drop-down menu, and click the corresponding equipment to complete the screen projection.

Teach you how to develop a completely new function of miracast
                 ? In the market, when the overall wireless screen casting delay is about 200ms, Huawei cast + kit has a number of self-developed technologies, which can achieve 50ms of ultra-low screen projection, ensuring the hand eye integration of large-scale mobile games.

Teach you how to develop a completely new function of miracast

  *The data is from Huawei laboratory, and there are differences in screen cast delay under different network environments
   for more development details of Huawei cast + kit, including business introduction, development guide, access preparation, how to obtain SDK, etc., please stamp the following airborne link:
   https://developer. Huawei.com/consumer/cn/cast Kit


Links to the past: don’t let algorithms and data structures drag your career

Original author: Plath

Recommended Today

Build HTTP service with C + + Mongoose

Mongoose source code address:https://github.com/cesanta/mo… Mongoose user manual:https://www.cesanta.com/devel… Mngoose set up HTTP service #include <string> #include “mongoose.h” using namespace std; static const char *s_http_port = “8000”; static void ev_handler(mg_connection *nc, int ev, void *ev_data) { struct http_message *hm = (struct http_message *) ev_data; if (ev == MG_EV_HTTP_REQUEST) { std::string uri; if (hm->uri.p && hm->uri.p[0] == ‘/’) […]