Created
November 3, 2012 19:52
-
-
Save heydona/4008494 to your computer and use it in GitHub Desktop.
Fetch video URL from Parse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PFQuery *query = [PFQuery queryWithClassName:@"Videos"]; | |
[query whereKey:@"videoId" equalTo:[NSNumber numberWithInteger:[[item objectForKey:@"videoID"] integerValue]]]; | |
[query whereKey:@"model" equalTo:model]; | |
[query whereKey:@"zingVersion" lessThanOrEqualTo:[NSNumber numberWithInteger:CURRENT_VERSION]]; | |
[query orderByDescending:@"zingVersion"]; | |
// Go get the name of the video | |
[query getFirstObjectInBackgroundWithBlock:^(PFObject *video, NSError *error) { | |
if (error) { | |
// ... | |
} else { | |
NSString *videoSource = [video objectForKey:@"videoURL"]; | |
if ([videoSource length] > 0) { | |
NSString *thumbnail = [video objectForKey:@"thumbnailURL"]; | |
NSString *script = [NSString stringWithFormat:@"createVideo('%@','%@')", thumbnail, videoSource]; | |
// ... | |
} | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment