Reply
Visitor
RebelProduction
Posts: 8
Registered: ‎11-29-2011
0 Kudos
Accepted Solution

iOS SDK: writing PCPlaylist or BCVideo to a file

Hi,

 

since the objects in the SDK aren'T NSCoder compliant, it isn't not possible to directly save these objects with NSKeyedArchiver. Does anyone know a way to do this?

 

There some playlist which are reloaded everytime our app starts, but I want to cache them to the filesystem, because there are nearly no changes of the videos in the playlist.

 

Thanks!

 

Kind Regards, Ingo

Brightcove Team
BC-ErikP
Posts: 15
Registered: ‎10-28-2010
0 Kudos

Re: iOS SDK: writing PCPlaylist or BCVideo to a file

You can use the -toDictionary method of the BCVideo class to obtain a representation of the BCVideo object that is an NSDictionary. NSDictionary implements NSCoding, so you can persist the NSDictionary object using an NSCoder. When you read back the NSDictionary from the archive, you can pass the resulting dictionary to the -initFromDictionary method to create a BCVideo from the archived data.

Visitor
RebelProduction
Posts: 8
Registered: ‎11-29-2011
0 Kudos

Re: iOS SDK: writing PCPlaylist or BCVideo to a file

Thanks, that worked.

 

I've just overlooked these two commands.

 

Kind Regards, Ingo Schramme

Visitor
RebelProduction
Posts: 8
Registered: ‎11-29-2011
0 Kudos

Re: iOS SDK: writing PCPlaylist or BCVideo to a file

Hi,

 

is it possible to do the same for BCPlaylist?

 

I now can save the playlist videos to a file but getting them back doesn't work cause I just get back the video info not the info for the playlist itself.

 

It really would help to have a [BCPlaylist toDictionary:NSDictionary]

 

Thanks.

 

Kind Regards, Ingo

Visitor
RebelProduction
Posts: 8
Registered: ‎11-29-2011
0 Kudos

Re: iOS SDK: writing PCPlaylist or BCVideo to a file

Hi,

 

again, there's a problem:

 

if you try the following:

 

BCVideo *testInput = [playlist.videos objectAtIndex:0];

NSLog(@"Input: %llu", testInput.videoId);
NSDictionary *testVideo = [BCVideo toDictionary:testInput];
NSLog(@"Output:: %@", testVideo);

 

Log:

 

Input: 1521044669001

Output: {
    FLVURL = ...;
    name = ...;
    shortDescription = ...;
    thumbnailURL = ...;
    videoId = 626246217;
    videoStillURL = ...;
}

as you can see, the video id is not saved properly. The Id seems to be saved as an unsigned int not as a unsigned long long.

 

The next problem is with initFromDictionary:

 

BCVideo *testOutputVideo = [BCVideo initFromDictionary:testVideo];
NSLog(@"Output from Dict: %@", testOutputVideo);


Output from Dict: BCVideo: id:0 name:...

 

Can you please fix it? Thanks.

 

Kind Regards, Ingo

Brightcove Team
BC-Oscar
Posts: 503
Registered: ‎12-11-2008
0 Kudos

Re: iOS SDK: writing PCPlaylist or BCVideo to a file

 

What version of the SDK are you using? I'd need to try this myself but the videoId was changed from double to long long some time ago so in theory it should work (unless you happen to have an older SDK version)

Visitor
RebelProduction
Posts: 8
Registered: ‎11-29-2011
0 Kudos

Re: iOS SDK: writing PCPlaylist or BCVideo to a file

Hi,

 

I'm using the latest SDK (2.1) thats not the problem.

 

I'm now rebuilding the Playlists by myself, but the problem that the ids are not saved still exist.

 

Just follow the example and you know what i mean.

 

Kind Regards, Ingo

Brightcove Team
BC-Oscar
Posts: 503
Registered: ‎12-11-2008
0 Kudos

Re: iOS SDK: writing PCPlaylist or BCVideo to a file

 

 I was able to reproduce and I got a fix. It should be released in the next couple of weeks, if you need early access to this version please send me a private message. 

Brightcove Team
BC-Oscar
Posts: 503
Registered: ‎12-11-2008
0 Kudos

Re: iOS SDK: writing PCPlaylist or BCVideo to a file

 

 We released a fix for this with version 2.2

Visitor
RebelProduction
Posts: 8
Registered: ‎11-29-2011
0 Kudos

Re: iOS SDK: writing PCPlaylist or BCVideo to a file

Hi,

 

is there a release date for the 2.2?

 

Thanks.

 

Cheers, Ingo