Live time--ios Live Client SDK, glamorous live "open source"

Source: Internet
Author: User

See the article I like very much, in order to facilitate their own view and reference so copy it over, source address: http://www.cnblogs.com/runner42/p/5241407.html

Please support the original author. If the original author sees you, please forgive me for copying you, purely for your convenience.

The current video broadcast is very hot, mobile phone video broadcast is also very hot, PGC, UGC, the video broadcast threshold has been reduced a lot.

This article describes a: IOS client Live SDK, the code is completely open source.

Live streaming: Let the iOS average developer make an rtmp live client in one day, with a glamorous live feature. (at the bottom of the article is the GitHub source address)

Includes features:

1, provide the iOS Apple phone rtmp push stream;

Fill in the RTMP service address and you can push the stream directly.

2, Live Beauty

Beauty can be installed live, IOS OpenGL glamorous acceleration, the phone is not hot at all.

3, front and rear camera switch 4 at any time, provide a callback for RTMP connection status

First, a simple literacy

The current stream is streamed to the RTMP server using the RTMP protocol.

The RTMP server then provides the RTMP video service;

Of course, the RTMP server also provides HLS, slicing the AV stream into a TS stream, and then the user can directly play the xxx.m3u8 streaming media.

Second, introduction to the use of the SDK

1, initialize

[LIVEVIDEOCORESDK Sharedinstance]: Global independent SDK instances, you do not have to manage the application and release of objects;

Initializing the rtmp connection and video parameters is simple:

[[Livevideocoresdk sharedinstance] Liveinit:rtmpurl Preview:self.view videsize:live_viedo_size_cif bitrate:live_ bitrate_500kbps framerate:live_framerate_20];

Parameters:

Rtmpurl:rtmp server address parameters, such as rtmp://192.168.30.191/live/123456

Preview:ios Local preview display of UIView objects, now like full-screen Live mode, here directly with Self.view

Videsize: Video resolution. Several video resolutions are available, CIF (320*640), D1 (540*960), 720P (720*1280)

Bitrate: Video bitrate. There are 500kbps corresponding cif,800kbps corresponding to D1, 2Mbps corresponds to 720p, how to configure the current bandwidth of your mobile phone.

Framerate: Video frame rate. This determines how smooth the video is, and the higher the frame rate the smoother the more. Available here: 15 frame/s,20 frame/s,25 frame/s,20 frame/s

2, connect rtmp video server

[[LIVEVIDEOCORESDK sharedinstance] connect];

After calling this interface, start to open the iphone local phone preview and start connecting to the RTMP server.

If the network is not a problem, rtmp server is not a problem, the broadcast will begin, simple!

3. Set Filter: Provides glamorous effects

-(void) SetFilter: (Live_filter_type) TYPE;

Currently provides a whitening effect, set a live_filter_beauty this parameter to see how whitening you have.

4. Set front and rear camera

-(void) Setcamerafront: (Boolean) Bcamerafrontflag;

The front and rear camera dynamically switch at any time, how to shoot on how to shoot.

5, set rtmp connection status callback

[Livevideocoresdk sharedinstance].delete = self;

Implement the protocol in your Viewcontroller: Livevcsessiondelegate, as follows, so you can always know the status of the rtmp connection.

Rtmp Status Delegate:

-(void) liveconnectionstatuschanged: (live_vcsessionstate) sessionstate{

Dispatch_async (Dispatch_get_main_queue (), ^{

Switch (sessionstate) {

Case live_vcsessionstatepreviewstarted:

_rtmpstatuslabel.text = @ "rtmp Status: Preview Not Connected";

Break

Case live_vcsessionstatestarting:

_rtmpstatuslabel.text = @ "rtmp status: In connection ...";

Break

Case live_vcsessionstatestarted:

_rtmpstatuslabel.text = @ "rtmp Status: Connected";

Break

Case live_vcsessionstateended:

_rtmpstatuslabel.text = @ "rtmp Status: Not Connected";

Break

Case LIVE_VCSESSIONSTATEERROR:

_rtmpstatuslabel.text = @ "rtmp Status: Error";

Break

Default

Break

}

});

}

6, end of broadcast, disconnect rtmp connection

[[Livevideocoresdk sharedinstance] disconnect]; simple, not explained.

GitHub Address: Https://github.com/runner365/LiveVideoCoreSDK

Live time--ios Live Client SDK, glamorous live "open source"

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.