ios - ReloadData vs ReloadRowsAtIndexPaths (Specifically regarding Video Data from Files) -


why downloading video filepath require [tableview reloaddata] in order seen on tableview?

i have been stuck on problem 3 days, , quite perplexed, , it's bad devforums down.

basically, have tableview. each table view cell has avplayer , given remote url. in cellforrowatindexpath, if video data not stored locally, downloads it, , saves file, , avplayer attempts play video @ saved file location.

the problem is, nothing ever gets played.

unless call [tableview reloaddata] in each cellforrowatindexpath in order videos rendered. realize may quite bad performance, as, not nice user, try using reloadrowsatindexpath each cell, not work.

why app need call reloaddata in order load data given local file location? , why doesn't reloadrowsatindexpath work? what's difference between two, in terms of getting video data has been written file path.

i'd rather not reload anything, it's app unaware of new data in given file path if not reload tableview.


code

    - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {         static nsstring *const cellidentifier = @"cellidentifier";         avideotableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];         avurlasset *asset = [avurlasset urlassetwithurl:[self geturl:someurlstring forindexpath:indexpath] options:nil];         avplayeritem *playeritem = [avplayeritem playeritemwithasset:asset];         if (!cell) {             cell = [[avideotableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];             cell.player = [[avplayer alloc] initwithplayeritem:playeritem];             avplayerlayer *layer = [avplayerlayer playerlayerwithplayer:cell.player];             cell.player.actionatitemend = avplayeractionatitemendnone;             layer.frame = cgrectmake(10.0, 10.0, 300.0, 179.0);             [cell.layer addsublayer: layer];         }         else {             [cell.player replacecurrentitemwithplayeritem:playeritem];         }         [cell.player play];      } 

so you're trying play video in each table cell? that's not going work. video playback extremely resource intensive. adding video layers table view cell each own player non-starter. it's hard enough table views perform still images if it's not done correctly. displaying video in real time in table cell nigh impossible. need reconsider approach design. maybe load poster image each video in table cell , playback when user taps on cell?

if insist on going route can see yourself, though, guess you're not using correct nsurl method instantiate file url. set breakpoint @ line:

avurlasset *asset = [avurlasset urlassetwithurl:                       [self geturl:someurlstring forindexpath:indexpath]                                          options:nil]; 

then step on line , hover mouse on asset variable. if it's nil, wrong nsurl you're instantiating in geturl:forindexpath: method.

make sure you're using [nsurl fileurlwithpath:] load disk. ios makes distinction between file urls , web urls. make sure file exists @ file url you're using.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -