ios - How to play video inside a UIView without controls, like a background/wallpaper? -


the goal playback video file (*.mp4) inside uiview without controls.

it serve background/wallpaper on viewcontroller , other controls, i.e. tableview, text fields, images shown on view video playedback.

what better way this? thank you

i've reached goal native avplayer

1.used avfoundation:

#import <avfoundation/avfoundation.h> 

2.used property player:

@property (nonatomic) avplayer *avplayer; 

3.added video file "video" folder , added "video" project

4.initialized player

nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"shutterstock_v885172.mp4" oftype:nil indirectory:@"video"]; nsurl *fileurl = [nsurl fileurlwithpath:filepath]; self.avplayer = [avplayer playerwithurl:fileurl]; self.avplayer.actionatitemend = avplayeractionatitemendnone;  avplayerlayer *videolayer = [avplayerlayer playerlayerwithplayer:self.avplayer]; videolayer.frame = self.view.bounds; videolayer.videogravity = avlayervideogravityresizeaspectfill; [self.view.layer addsublayer:videolayer];  [self.avplayer play]; 

5.subscribed event - video did play end

[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(itemdidfinishplaying:) name:avplayeritemdidplaytoendtimenotification object:[self.avplayer currentitem]];  

6.resumed video playing start in related method

- (void)itemdidfinishplaying:(nsnotification *)notification {     avplayeritem *player = [notification object];     [player seektotime:kcmtimezero]; } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -