Commit aeb1ac51 authored by Felix Paul Kühne's avatar Felix Paul Kühne

media player: add new notifications for title and chapter change

(cherry picked from commit 5654db3f)
parent aac0a22d
......@@ -42,6 +42,8 @@
/* Notification Messages */
extern NSString *const VLCMediaPlayerTimeChanged;
extern NSString *const VLCMediaPlayerStateChanged;
extern NSString *const VLCMediaPlayerTitleChanged;
extern NSString *const VLCMediaPlayerChapterChanged;
/**
* VLCMediaPlayerState describes the state of the media player.
......@@ -85,6 +87,21 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
*/
- (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
/**
* Sent by the default notification center whenever the player's title has changed (if any).
* \details Discussion The value of aNotification is always an VLCMediaPlayerTitleChanged notification. You can retrieve
* the VLCMediaPlayer object in question by sending object to aNotification.
* \note this is about a title in the navigation sense, not about metadata
*/
- (void)mediaPlayerTitleChanged:(NSNotification *)aNotification;
/**
* Sent by the default notification center whenever the player's chapter has changed (if any).
* \details Discussion The value of aNotification is always an VLCMediaPlayerChapterChanged notification. You can retrieve
* the VLCMediaPlayer object in question by sending object to aNotification.
*/
- (void)mediaPlayerChapterChanged:(NSNotification *)aNotification;
#if TARGET_OS_PHONE
/**
* Sent by the default notification center whenever a new snapshot is taken.
......
......@@ -14,6 +14,7 @@ New APIs:
snapshots, lastSnapshot
- added selectors: chaptersForTitleIndex:
numberOfChaptersForTitle:
- added notifications: VLCMediaPlayerTitleChanged, VLCMediaPlayerChapterChanged
- VLCMedia
- added keys: VLCMetaInformationTrackTotal, VLCMetaInformationDirector,
......
......@@ -50,6 +50,8 @@
/* Notification Messages */
NSString *const VLCMediaPlayerTimeChanged = @"VLCMediaPlayerTimeChanged";
NSString *const VLCMediaPlayerStateChanged = @"VLCMediaPlayerStateChanged";
NSString *const VLCMediaPlayerTitleChanged = @"VLCMediaPlayerTitleChanged";
NSString *const VLCMediaPlayerChapterChanged = @"VLCMediaPlayerChapterChanged";
NSString *const VLCMediaPlayerSnapshotTaken = @"VLCMediaPlayerSnapshotTaken";
/* title keys */
......@@ -144,6 +146,24 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
}
}
static void HandleMediaTitleChanged(const libvlc_event_t * event, void * self)
{
@autoreleasepool {
[[VLCEventManager sharedManager] callOnMainThreadDelegateOfObject:(__bridge id)(self)
withDelegateMethod:@selector(mediaPlayerTimeChanged:)
withNotificationName:VLCMediaPlayerTitleChanged];
}
}
static void HandleMediaChapterChanged(const libvlc_event_t * event, void * self)
{
@autoreleasepool {
[[VLCEventManager sharedManager] callOnMainThreadDelegateOfObject:(__bridge id)(self)
withDelegateMethod:@selector(mediaPlayerChapterChanged:)
withNotificationName:VLCMediaPlayerChapterChanged];
}
}
#if TARGET_OS_IPHONE
static void HandleMediaPlayerSnapshot(const libvlc_event_t * event, void * self)
{
......@@ -172,6 +192,9 @@ static void HandleMediaPlayerSnapshot(const libvlc_event_t * event, void * self)
- (void)mediaPlayerPositionChanged:(NSNumber *)newTime;
- (void)mediaPlayerStateChanged:(NSNumber *)newState;
- (void)mediaPlayerMediaChanged:(VLCMedia *)media;
- (void)mediaPlayerTitleChanged:(NSNumber *)newTitle;
- (void)mediaPlayerChapterChanged:(NSNumber *)newChapter;
#if TARGET_OS_IPHONE
- (void)mediaPlayerSnapshot:(NSString *)fileName;
#endif
......@@ -1262,6 +1285,9 @@ static void HandleMediaPlayerSnapshot(const libvlc_event_t * event, void * self)
libvlc_event_attach(p_em, libvlc_MediaPlayerTimeChanged, HandleMediaTimeChanged, (__bridge void *)(self));
libvlc_event_attach(p_em, libvlc_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, (__bridge void *)(self));
libvlc_event_attach(p_em, libvlc_MediaPlayerTitleChanged, HandleMediaTitleChanged, (__bridge void *)(self));
libvlc_event_attach(p_em, libvlc_MediaPlayerChapterChanged, HandleMediaChapterChanged, (__bridge void *)(self));
#if TARGET_OS_IPHONE
libvlc_event_attach(p_em, libvlc_MediaPlayerSnapshotTaken, HandleMediaPlayerSnapshot, (__bridge void *)(self));
#endif
......@@ -1285,6 +1311,9 @@ static void HandleMediaPlayerSnapshot(const libvlc_event_t * event, void * self)
libvlc_event_detach(p_em, libvlc_MediaPlayerTimeChanged, HandleMediaTimeChanged, (__bridge void *)(self));
libvlc_event_detach(p_em, libvlc_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, (__bridge void *)(self));
libvlc_event_detach(p_em, libvlc_MediaPlayerTitleChanged, HandleMediaTitleChanged, (__bridge void *)(self));
libvlc_event_detach(p_em, libvlc_MediaPlayerChapterChanged, HandleMediaChapterChanged, (__bridge void *)(self));
#if TARGET_OS_IPHONE
libvlc_event_detach(p_em, libvlc_MediaPlayerSnapshotTaken, HandleMediaPlayerSnapshot, (__bridge void *)(self));
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment