IOS uses ijkplayer to broadcast RTSP streams

Company to do so on the VOD platform, several players: Baidu, Vitamio, ijkplayer. Synthesis of these three player features, both broadcast RTSP stream, and can instantiate a number of, ijkplayer or better, so choose this. Since there are many twists and turns in the implementation process, we share this process with you. Download the ijkplayer demo GitHub, GIT clone https://github.com/Bilibili/ijkplayer.git ijkplayer-ios. GitHub URL: https://github.com/Bilibili/ijkplayer, utm_source=tuicool& utm_medium=referral. Ijkplayer requires homebrew, GIT, and yasm environments

1. before you run, you need to deploy the environment

IOS uses ijkplayer to broadcast RTSP streams

2. modify the module-lite.sh file

IOS uses ijkplayer to broadcast RTSP streams

Open the demo folder, locate the config folder under the module-lite.sh file, modify the line COMMON_FF_CFG_FLAGS = “$COMMON_FF_CFG_FLAGS –disable – RTP protocol =” –&gt COMMON_FF_CFG_FLAGS = modification; “$COMMON_FF_CFG_FLAGS –enable – RTP protocol =”, and again on this below this line: export COMMON_FF_CFG_FLAGS= $COMMON_FF_CFG_FLAGS –enable-demuxer=rtsp”

3. execute command line

IOS uses ijkplayer to broadcast RTSP streams

4. modify the ff_ffplay.c file

IOS uses ijkplayer to broadcast RTSP streams

Take this piece of code

Static int packet_queue_get_or_buffering (FFPlayerffp, PacketQueue *q, AVPacket *pkt, int *serial, int *finished) {assert (finished); while (1) {int new_packet = packet_queue_get (Q, pkt, 0, serial); if (new_packet < return -1; 0) else if (new_packet = = 0 {if (q-&gt) is_buffer_indicator; & & finished!) ffp_toggle_buffering (FFP, 1); new_packet = packet_queue_get (Q, pkt, 1, serial); if (new_packet < return -1;} 0)

If (*finished = = *serial) {av_free_packet (pkt); continue;}

Else break;}

Return 1;}

replace with

Static int packet_queue_get_or_buffering (FFPlayer *ffp, PacketQueue *q, AVPacket *pkt, int *serial, int finished) {while (1) {int new_packet = packet_queue_get (Q, pkt, 1, serial); if (new_packet < 0) {new_packet = packet_queue_get (Q, pkt, 0, if (new_packet &lt serial); 0); return -1;}

Else if (new_packet = = 0) {if (finished!) ffp_toggle_buffering (FFP, 1); new_packet = packet_queue_get (Q, pkt, 1, serial); if (new_packet < return -1;} 0)

If (finished = = *serial) {av_free_packet (pkt); continue;}

Else break;}

Return 1;

}

5. compile ffmpeg,

CD ijkplayer-ios git checkout -B latest k0.5.1./init-ios.sh CD IOS./compile-ffmpeg.sh clean./compile-ffmpeg.sh all

Compile time is longer, please wait patiently, after success can run Demo, compiled successfully after the IOS folder, the following directory is like this

IOS uses ijkplayer to broadcast RTSP streams

The compilation process my Xcode do not know how, always wrong, finally in desperation to reinstall Xcode, then there is no problem, I do not know how this rookie, anyway, suggesting that bin folder file is missing, do not understand

Then is to package the IJKMediaFramework.framework framework, this process is to learn from others, here I will not steal, we see here the specific http://www.jianshu.com/p/1f06b27b3ac0 packaging process, and then the frame into your project, add the corresponding frame, you can play RTSP stream

Also need your attention, if the project is to use cocapod, the problem appears on my side

IOS uses ijkplayer to broadcast RTSP streams

Looking for a long time did not find the reason, and then God gave me a pointer, add libz.tdb in the project, so as to run successfully