Blibli and pull-flow lflivekit of live push stream

Source: Internet
Author: User

After doing this, import the synthesized pull-stream Blibli package into the project, and then create a new playback controller to set the playback

1. Some of the actions played.

2. Gaussian Blur.

3. Create a new chat controller.

- (void) viewdidload {[Super viewdidload]; //Do any additional setup after loading the view from its nib.[Self initplayer];//Add player[Self loadui];//Add Gaussian Blur[Self LOADCHATVC];//Load Chat Controller}- (void) Viewwillappear: (BOOL) animated {[Super viewwillappear:animated]; Self.navigationController.navigationBar.hidden=YES;        [Self installmovienotificationobservers]; [Self.player Preparetoplay];}- (void) Viewdiddisappear: (BOOL) animated {[Super viewdiddisappear:animated]; Self.navigationController.navigationBar.hidden=NO;    [Self.player shutdown]; [Self removemovienotificationobservers];}- (void) Setlives: (Strhotlive *) lives{_lives=lives;}- (void) initplayer{#ifdefDEBUG [Ijkffmovieplayercontroller Setlogreport:yes]; [Ijkffmovieplayercontroller Setloglevel:k_ijk_log_debug];#else[Ijkffmovieplayercontroller Setlogreport:no]; [Ijkffmovieplayercontroller Setloglevel:k_ijk_log_info];#endifijkffoptions*options =[Ijkffoptions Optionsbydefault]; Self.player= [[Ijkffmovieplayercontroller alloc] Initwithcontenturl:[nsurl urlwithstring:[nsstring stringWithFormat:@"%@", _lives.streamaddr]]    Withoptions:options]; Self.player.view.frame=Self.view.bounds; Self.player.scalingMode=Ijkmpmoviescalingmodeaspectfit; Self.player.shouldAutoplay=YES; [Self.view AddSubview:self.player.view];}- (void) loadui{[Self.view Setbackgroundcolor:strcolor (0,0,0)]; [Self loadblurimage];}- (void) loadchatvc{[self addChildViewController:self.chatVc];    [Self.view AddSubview:self.chatVc.view]; SELF.CHATVC.Delegate=Self ;    weakself; [Self.chatVc.view mas_makeconstraints:^ (Masconstraintmaker *Make )    {Make.edges.equalTo (Weakself.view); }];}- (void) loadblurimage{Uiimageview*blurimagev =[[Uiimageview alloc] init]; Blurimagev.frame=Self.view.bounds; [Blurimagev sd_setimagewithurl:[nsurl urlwithstring:[nsstring stringWithFormat:@"%@", _lives.creator.portrait]] placeholderimage:[uiimage imagenamed:@"Default_room"]]; Uiblureffect*blure =[Uiblureffect Effectwithstyle:uiblureffectstylelight]; Uivisualeffectview*effectview =[[Uivisualeffectview alloc] initwitheffect:blure]; Effectview.frame=Blurimagev.bounds;    [Blurimagev Addsubview:effectview];    [Self.view Addsubview:blurimagev]; Self.blurimageview=Blurimagev;}#pragmaMark---delegate-(void) Chatliveviewcontroller: (Strchatliveviewcontroller *) CHATVC Didbuttonclickwithsender: (UIButton *) sender{[self Dismissviewcontrolleranimated:yes completion:nil];}#pragmaMark---noti-(void) Loadstatedidchange: (nsnotification*) notification{//mpmovieloadstateunknown = 0,//mpmovieloadstateplayable = 1 << 0,//Mpmovieloadstateplaythroughok = 1 << 1,//Playback'll be automatically started in the If Shouldautoplay is YES//mpmovieloadstatestalled = 1 << 2,//Playback'll be automatically paused in this state, if startedijkmpmovieloadstate loadState=_player.loadstate; if((LoadState & Ijkmpmovieloadstateplaythroughok)! =0) {NSLog (@"Loadstatedidchange:ijkmpmovieloadstateplaythroughok:%d\n", (int) loadState); } Else if((LoadState & ijkmpmovieloadstatestalled)! =0) {NSLog (@"loadstatedidchange:ijkmpmovieloadstatestalled:%d\n", (int) loadState); } Else{NSLog (@"loadstatedidchange:???:%d\n", (int) loadState); }}- (void) Movieplaybackdidfinish: (nsnotification*) notification{//mpmoviefinishreasonplaybackended,//Mpmoviefinishreasonplaybackerror,//mpmoviefinishreasonuserexited    intReason =[[[ notification UserInfo] valueforkey:ijkmpmovieplayerplaybackdidfinishreasonuserinfokey] intvalue]; Switch(reason) { CaseIjkmpmoviefinishreasonplaybackended:nslog (@"playbackstatedidchange:ijkmpmoviefinishreasonplaybackended:%d\n", reason);  Break;  CaseIjkmpmoviefinishreasonuserexited:nslog (@"playbackstatedidchange:ijkmpmoviefinishreasonuserexited:%d\n", reason);  Break;  CaseIjkmpmoviefinishreasonplaybackerror:nslog (@"playbackstatedidchange:ijkmpmoviefinishreasonplaybackerror:%d\n", reason);  Break; default: NSLog (@"playbackplaybackdidfinish:???:%d\n", reason);  Break; }}- (void) Mediaispreparedtoplaydidchange: (nsnotification*) notification{NSLog (@"mediaispreparedtoplaydidchange\n");}- (void) Movieplaybackstatedidchange: (nsnotification*) notification{//mpmovieplaybackstatestopped,//mpmovieplaybackstateplaying,//mpmovieplaybackstatepaused,//mpmovieplaybackstateinterrupted,//Mpmovieplaybackstateseekingforward,//Mpmovieplaybackstateseekingbackward        Switch(_player.playbackstate) { Caseijkmpmovieplaybackstatestopped: {NSLog (@"Ijkmpmovieplaybackstatedidchange%d:stoped", (int) _player.playbackstate);  Break; }         Caseijkmpmovieplaybackstateplaying: {NSLog (@"Ijkmpmovieplaybackstatedidchange%d:playing", (int) _player.playbackstate);  Break; }         Caseijkmpmovieplaybackstatepaused: {NSLog (@"Ijkmpmovieplaybackstatedidchange%d:paused", (int) _player.playbackstate);  Break; }         Caseijkmpmovieplaybackstateinterrupted: {NSLog (@"Ijkmpmovieplaybackstatedidchange%d:interrupted", (int) _player.playbackstate);  Break; }         CaseIjkmpmovieplaybackstateseekingforward: CaseIjkmpmovieplaybackstateseekingbackward: {NSLog (@"Ijkmpmovieplaybackstatedidchange%d:seeking", (int) _player.playbackstate);  Break; }        default: {NSLog (@"Ijkmpmovieplaybackstatedidchange%d:unknown", (int) _player.playbackstate);  Break; }} Self.blurImageView.hidden=YES; [Self.blurimageview Removefromsuperview];}#pragmaMark Install Movie Notifications/*Register observers for the various movie object notifications.*/-(void) installmovienotificationobservers{[[Nsnotificationcenter Defaultcenter] Addobserver:self Selector: @selector (loadstatedidchange:) name:ijkmpmovi EplayerloadstatedidchangenotificationObject: _player]; [[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (movi                                               Eplaybackdidfinish:) name:ijkmpmovieplayerplaybackdidfinishnotification Object: _player]; [[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (Medi Aispreparedtoplaydidchange:) Name:ijkmpmediaplaybackispreparedtoplaydidcha NgenotificationObject: _player]; [[Nsnotificationcenter Defaultcenter] addobserver:self selector: @selector (movi Eplaybackstatedidchange:) name:ijkmpmovieplayerplaybackstatedidchangenotif IcationObject: _player];}#pragmaMark Remove Movie Notification handlers/*Remove The movie notification observers from the movie object.*/-(void) removemovienotificationobservers{[[Nsnotificationcenter defaultcenter]removeobserver:self Name:I JkmpmovieplayerloadstatedidchangenotificationObject: _player]; [[Nsnotificationcenter defaultcenter]removeobserver:self name:ijkmpmovieplayerplaybackdidfinishnotificationObject: _player]; [[Nsnotificationcenter defaultcenter]removeobserver:self Name:i JkmpmediaplaybackispreparedtoplaydidchangenotificationObject: _player]; [[Nsnotificationcenter defaultcenter]removeobserver:self Name:ijkmpmovieplayerplaybackstatedidchangenotification Object: _player];}#pragmaMark---getters and setters-(Strchatliveviewcontroller *) chatvc{if(_CHATVC = =Nil) {_CHATVC=[[Strchatliveviewcontroller alloc] init]; }    return_CHATVC;}

Blibli and pull-flow lflivekit of live push stream

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.