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——
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——
- First, create an application project and add the required permissions in Android manifest
- Add the AAR file of SDK in the Lib directory, and set the build.gradle Add the dependency of SDK.
- Initializing related services and instances
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
- 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.
- 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.
- 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.
- 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.
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.
? 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.
*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