last day (14 days later) » 

08:03
0
Q: Video not play in tableview cell in IOS

IOS_DEVhere is my code i want to play video to click play button.only display AVplayer but not play video.i will also add AVKit framework.if i want to display thumbnail to video than how can i got it. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{...

I've just put your video link in my iOS app and it was failed to load.
@nynohu sure check my url
@nynohu but in browser play this video just paste link and load safari
Yes I tried http://techslides.com/demos/sample-videos/small.mp4.
@nynohu any problem in mycode?
Yes it worked in browser but playerVC.player.status return AVPlayerStatusUnknown in - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context. I don't know it clearly but I think you will try another video and check the result.
08:03
@nynohu i will also try this link youtube.com/watch?v=PCwL3-hkKrg
hi
Well, I think I know your problem. The video cannot be loaded because of ATS (app transport security).
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
put that config to your info.plist file and the video will be loaded.
i already add this
So the video still cannot be loaded?
yes
video not play
I've just tried it and your video was loaded correctly
08:08
which one link?
wait i will send screenshot
i want to display video in cell
my code for init video player and handling video player status:
        self.boardEntry.linkParam = @"http://techslides.com/demos/sample-videos/small.mp4";
        NSURL *streamURL = [NSURL URLWithString:self.boardEntry.linkParam];
        AVURLAsset *asset = [AVURLAsset URLAssetWithURL:streamURL options:nil]; // Option @{@"AVURLAssetHTTPHeaderFieldsKey":headers}
        AVPlayerItem *item = [AVPlayerItem playerItemWithAsset:asset];
        self.playerController.player = [[AVPlayer alloc] initWithPlayerItem:item];
        self.waitingLabel.hidden = YES;
        [self.playerController.player.currentItem addObserver:self forKeyPath:@"status" options:NSKey
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (object == self.playerController.player.currentItem && [keyPath isEqualToString:@"status"]) {
if (self.playerController.player.currentItem.status == AVPlayerItemStatusReadyToPlay) {
NSLog(@"Ready for play");
self.waitingLabel.hidden = YES;
} else if (self.playerController.player.status == AVPlayerItemStatusFailed || self.playerController.player.status == AVPlayerItemStatusUnknown) {
ok i will add code
You need to check player status. That returned AVPlayerStatusUnknown before I add NSAllowsArbitraryLoads to plist.
08:17
but in my code this method not called
_
self.boardEntry.linkParam this is nsstring?
yes
wait for a minute. I will give you a video link with fully ATS supported
ok i will copu your whole code
ok
Just try that video
check it can be loaded or not
08:23
ok
avplayer load but after display not video
check this
Which code did you use? Your original code or my code?
in your code is missing play video code
if possible send me demo?
Hm, in my app, user need to press play button of AVPlayerVC
so it is not calling play video function automatically
in my app every cell display play button,user click play button than play video in cell
I think it does not make the problem that you faced with.
Just tried my initial video player I sent you
08:31
ok
No need to check status
just try it and check video can be played or not
I've tried you code . It cannot play video without NSAllowsArbitraryLoads (NO) and can play video normally with NSAllowsArbitraryLoads (YES). Are you sure you did set that property properly?
I must return home now and will not discuss with you for about 2 hours. Please continue with your effort. Cheers

last day (14 days later) »