aboutsummaryrefslogtreecommitdiffstats
path: root/Video Tuneup/ViewController.m
diff options
context:
space:
mode:
authorBrian Jordan2012-04-25 23:58:08 -0400
committerBrian Jordan2012-04-25 23:58:08 -0400
commit541a72c7fda508ec21e1adf8da66043807687222 (patch)
tree0607e58143e9de6c3496efd7e364a3ddfdfd7c9f /Video Tuneup/ViewController.m
parent3c243aeaba4540732f820ec5d88c7cca3277bc5e (diff)
downloadVideo-Tuneup-541a72c7fda508ec21e1adf8da66043807687222.tar.bz2
Load picked music into video. Resolves Issue #22
Diffstat (limited to 'Video Tuneup/ViewController.m')
-rw-r--r--Video Tuneup/ViewController.m21
1 files changed, 13 insertions, 8 deletions
diff --git a/Video Tuneup/ViewController.m b/Video Tuneup/ViewController.m
index 6637c9d..73a1e67 100644
--- a/Video Tuneup/ViewController.m
+++ b/Video Tuneup/ViewController.m
@@ -108,9 +108,13 @@ mScrubber, mediaLibraryButton, mediaLibraryPopover;
[self loadAssetFromFile:fileURL];
}
-- (IBAction)loadAudioFromFile:(id)sender {
+- (IBAction)loadDefaultAudioFromFile:(id)sender {
NSURL *songFileURL = [[NSBundle mainBundle]
URLForResource:@"song" withExtension:@"mp3"];
+ [self loadAudioFromFile:songFileURL];
+}
+
+- (IBAction)loadAudioFromFile:(NSURL *)songFileURL {
songAsset = [AVURLAsset URLAssetWithURL:songFileURL options:nil];
NSLog(@"Song asset duration is %f", CMTimeGetSeconds([songAsset duration]));
@@ -118,6 +122,9 @@ mScrubber, mediaLibraryButton, mediaLibraryPopover;
[self refreshEditor];
}
+#pragma mark -
+#pragma mark Audio picker
+
- (IBAction)showMediaPicker:(id)sender
{
MPMediaPickerController *mediaPicker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
@@ -134,13 +141,11 @@ mScrubber, mediaLibraryButton, mediaLibraryPopover;
if (mediaItemCollection) {
NSLog(@"Got media item");
-// [musicPlayer setQueueWithItemCollection: mediaItemCollection];
-// [musicPlayer play];
- NSLog(@"%@",[[[mediaItemCollection items] objectAtIndex:0]valueForKey:MPMediaItemPropertyTitle]);
-
- NSURL *url = [[[mediaItemCollection items] objectAtIndex:0] valueForProperty:MPMediaItemPropertyAssetURL];
-
- NSLog(@"%@", url);
+// NSLog(@"%@",[[[mediaItemCollection items] objectAtIndex:0]valueForKey:MPMediaItemPropertyTitle]);
+// NSURL *url = [[[mediaItemCollection items] objectAtIndex:0] valueForProperty:MPMediaItemPropertyAssetURL];
+// NSLog(@"%@", url);
+
+ [self loadAudioFromFile:url];
} else {NSLog(@"Didn't get media item!");}