ios AVPlayer failed to stream remote video -
i have avplayer
plays video remote url.
here code:
avplayeritem* playeritem = [avplayeritem playeritemwithurl:videourl]; self.player = [avplayer playerwithplayeritem:playeritem]; self.player.actionatitemend = avplayeractionatitemendnone; avplayerlayer *playerlayer = [avplayerlayer playerlayerwithplayer:self.player]; playerlayer.frame = playerview.bounds; [playerview.layer addsublayer:playerlayer]; [self.player play];
when start stream have less second video chunck , downloading stops , nothing happens.
mpmovieplayercontroller , browser plays video usual.
i doubt, might effect of cropping video (because videos without cropping works fine). here guide use crod video http://www.one-dreamer.com/cropping-video-square-like-vine-instagram-xcode/
also clean app same setup can't play video.
any ideas? thanks!
use avplayeritemplaybackstallednotification
[[nsnotificationcenter defaultcenter] addobserverforname:avplayeritemplaybackstallednotification object:nil queue:[nsoperationqueue mainqueue] usingblock:^(nsnotification *note) { [weakself performblockonmainqueueafterdelay:1.5 block:^{ [weakself.player play]; }]; }];
Comments
Post a Comment