I have been busy recently. I just took over a live video and on-demand video broadcast project. The video stream on the server is based on the HLS protocol. I will not introduce the HLS protocol here. Please refer to the official website of apple. When I took over the project, I tried several open-source players, such as mplayer, VLC, and ffplayer. The effects were not very good. When playing m3u8 list, there were more or less problems. After consideration, I chose VLC, read the VLC source code for about a week, and have some knowledge about the VLC source code architecture. I focused on the main process of playing m3u8, parsing m3u8 files in VLC is in modules \ stream_filter \ httplive. c file.
After a playback test, it is found that there is no problem in VLC playing live streams, but it can also be understood as live streaming. However, its m3u8 file tag is somewhat different from Vod, I don't know why different tags are generated when the server is split. After analysis, it is found that VLC does not support HLS protocol well and does not support HLS protocol labels. After two days of modification, the problem of VOD and playback was solved.
However, this problem occurs again. The current playback time and video length are not realistic during VOD and playback. After investigation, we found that httplive. C does not have this part at all.CodeAfter a day of hard work, add this part of code to solve this problem.
When calculating the video length, it is related to the HLS Protocol version number ....... If the version number is smaller than 3, it is obtained as an integer. Otherwise, it is a floating point type. The integer is different from the actual video length ......
If you need to solve this problem, contact me ...... RMB