HLS live broadcast technical solutions and pitfalls, hls live broadcast technical solutions

Source: Internet
Author: User

HLS live broadcast technical solutions and pitfalls, hls live broadcast technical solutions
For personal information about the old code farmers, please see here: http://www.koulianbing.com /? Page_id = 12
I. Why is IJKPlayer having mature backend systems in terms of basic technology? let's leave it alone. Let's talk about the client. There will be bullet screens when there is a live video, which is basically the standard. In terms of subtitles, bilibili has an open-source Android project, but it does not exist in IOS. This project can only be written by myself. However, there is nothing too advanced about this technical solution, and an HTTP connection is established, you can stop reading data. If you close the subtitles, You can disconnect the connection. In terms of display, you may need to consider some details, such as speed, location, word limit, and so on. In terms of players, Android and IOS theoretically support HLS playback. However, there are many adaptation problems in the actual application process. Therefore, the IJKPlayer open-source by bilibili is generally used in the industry, douyu TV and others are self-built based on IJKPlayer. Their technical solutions are mature, stable, and easy to use. The project compilation scripts are simple and flexible. Ii. Use of IJKPlayer. After the project is cloned, the first thing to do is to configure Codec, because IJKPlayer uses ffmpeg for Codec. If it is not cropped, the compiled library will be surprisingly large. Let's take a look at config/module. sh. It's okay to note unnecessary codec. I only use aac and H264. In the last two platforms, the Size was about 1 MB. As a player, the Size was definitely small. Currently, mainstream Android machines support ARMV7, which is sufficient. for IOS, ARMV7, ARMV7s, and ARM64 are supported. i386 is also required for debugging, for the sake of simplicity, in the test phase, I generated libraries that support the four CPU architectures ARMV7, ARMV7s, ARM64, and i386, and then removed the i386 architecture code at the release stage, further reduce the package size. The following uses IOS as an example to describe the entire compilation process. 1. Modify config/module. sh, crop the required codec and other configurations, Remove unused ones, and reduce the size of the final generated package. 1. Execute the init-ios.sh, here mainly download the ffmpeg code. 2, execute ios/compile-ffmpeg.sh, here mainly compile ffmpeg code. You can modify the configurations to determine which CPU architecture to compile. The options include arm7s, arm64, i386, and ipv_64. 3. After compilation is complete, open IJKMediaPlayer and Build. IJKMediaPlayer is a. a project. During Build, in build setting of IJKMediaPlayer, the CPU architecture lists of ubuntures and Valid ubuntures are armv7, armv7s, and arm64. If the target in the Schema selects the simulator, the generated. library a has two CPU architecture commands, i386 and x86_64. a is integrated into my project. When xcodebuild is used for packaging, an error is reported that armv7, armv7s, arm64, and other architecture commands are not found. If the target in the Schema is iOS device, then the generated. the a library file only contains commands for the armv7, armv7s, and arm64 CPU architectures. When I integrate them into my project and use XCode for compilation, the i386 architecture commands cannot be found, and an error is also reported. Finally, use lipo create, so two. the a library file is Merge, and the problem is solved. database a is relatively large, so we had to cut out the commands for the i386 and x86_64 CPU architectures at the time of release. 4. Put the compiled libIJKMediaPlayer. a and the corresponding include file into the project. The location of the library file and header file is here: Open the finder, open "go" in the menu, hold down Alt, and click "resource library" in the menu, Developer-> Xcode-> DerivedData, find the IJKMediaPlayer prefix folder and click it to enter. Each subfolders in the folder corresponds to the one generated in Debug/Release and IOS device/simulator. library a and header files. 5. The. a file is generated very large. I have over 20 mb here, but the package size increases by more than 1 MB after the project is packaged. The big difference in this number is really surprising. We all know that the old coders are the most curious, turning the Internet to the ground, and finally confirmed the reasons as follows: 3 ,. a compression optimization 1. Compilation optimization options are not set. Later I compile libIJKMediaPlayer. a, set the optimization items in Build Setting (see Article 6 for specific settings) and generate libIJKMediaPlayer. a to 7 M +. 2. During App packaging. a and the code in the App are linked. After the Link is completed, many codes will be deleted. the intermediate information used in Link a. After Link is completed, the information is deleted. Iv. Technical Selection the selection of live video Implementation Solutions and detailed analysis of the advantages and disadvantages of HLS can be found in this article: Build Setting) 1. According to the optimization methods mentioned in the two articles: http://blog.cnbang.net/tech/2544/http://m.blog.csdn.net/blog/lfr_de V/384429072 and strip style use non-global symbols in non-app projects and all in app projects. 3. The most detailed explanation of Build Settings, of course, is still the official documentation: Secure link map file: http://blog.cnbang.net/tech/2296/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.