Browse Source

Added delegate method for snapshot

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Paulo Vitor Magacho da Silva 9 years ago
parent
commit
15f31eaf13
2 changed files with 14 additions and 0 deletions
  1. 9 0
      Headers/Public/VLCMediaPlayer.h
  2. 5 0
      Sources/VLCMediaPlayer.m

+ 9 - 0
Headers/Public/VLCMediaPlayer.h

@@ -85,6 +85,15 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
  */
 - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
 
+#if TARGET_OS_PHONE
+/**
+ * Sent by the default notification center whenever a new snapshot is taken.
+ * \details Discussion The value of aNotification is always an VLCMediaPlayerSnapshotTaken notification. You can retrieve
+ * the VLCMediaPlayer object in question by sending object to aNotification.
+ */
+- (void)mediaPlayerSnapshot:(NSNotification *)aNotification;
+#endif
+
 @end
 
 

+ 5 - 0
Sources/VLCMediaPlayer.m

@@ -50,6 +50,7 @@
 /* Notification Messages */
 NSString *const VLCMediaPlayerTimeChanged       = @"VLCMediaPlayerTimeChanged";
 NSString *const VLCMediaPlayerStateChanged      = @"VLCMediaPlayerStateChanged";
+NSString *const VLCMediaPlayerSnapshotTaken     = @"VLCMediaPlayerSnapshotTaken";
 
 /* title keys */
 NSString *const VLCTitleDescriptionName         = @"VLCTitleDescriptionName";
@@ -151,6 +152,10 @@ static void HandleMediaPlayerSnapshot(const libvlc_event_t * event, void * self)
             [[VLCEventManager sharedManager] callOnMainThreadObject:(__bridge id)(self)
                                                          withMethod:@selector(mediaPlayerSnapshot:)
                                                withArgumentAsObject:[NSString stringWithUTF8String:event->u.media_player_snapshot_taken.psz_filename]];
+
+            [[VLCEventManager sharedManager] callOnMainThreadDelegateOfObject:(__bridge id)(self)
+                                                           withDelegateMethod:@selector(mediaPlayerSnapshot:)
+                                                         withNotificationName:VLCMediaPlayerSnapshotTaken];
         }
     }
 }