简体   繁体   中英

Xcode dropbox sync api play videos

Hey guys a quick question!

I am making an iPad app which uses the dropbox sync api. Now I am wondering how to play movie files within my dropbox filesystem in the MPMovieplayer. Since the dropbox filesystem is not the same as the local sandbox and I don't know how to retrieve a nsurl of the file I can't play the video.

This is something I tried (my last hope) but it doesn't work:

+(NSString*)loadMovie : (DBPath*)path
{
    DBFile *file = [self openFileAtPath:path];
    NSData *data = [[NSData alloc] initWithData:[file readData:nil]];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *vpath = [documentsDirectory stringByAppendingPathComponent:file.info.path.name];
    [[NSFileManager defaultManager] createFileAtPath:vpath contents:data attributes:nil];
    return vpath;
}

You'll need to write the file out to local storage first. See https://forums.dropbox.com/topic.php?id=110085 on the Dropbox forum.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM