Przeglądaj źródła

media list player: add selectors to set drawable on init matching the media player class

(cherry picked from commit 6012c098558732a953261c69828ece62a207bd5c)
Felix Paul Kühne 9 lat temu
rodzic
commit
2438276456
3 zmienionych plików z 21 dodań i 2 usunięć
  1. 2 0
      Headers/Public/VLCMediaListPlayer.h
  2. 4 0
      NEWS
  3. 15 2
      Sources/VLCMediaListPlayer.m

+ 2 - 0
Headers/Public/VLCMediaListPlayer.h

@@ -48,7 +48,9 @@ typedef NS_ENUM(NSInteger, VLCRepeatMode) {
 @property (readwrite) VLCMedia *rootMedia;
 @property (readonly) VLCMediaPlayer *mediaPlayer;
 
+- (instancetype)initWithDrawable:(id)drawable;
 - (instancetype)initWithOptions:(NSArray *)options;
+- (instancetype)initWithOptions:(NSArray *)options andDrawable:(id)drawable;
 
 /**
  * Basic play, pause and stop are here. For other methods, use the mediaPlayer.

+ 4 - 0
NEWS

@@ -17,6 +17,10 @@ New APIs:
   - added notifications: VLCMediaPlayerTitleChanged, VLCMediaPlayerChapterChanged
   - Note: play's return type was changed from BOOL to void
 
+- VLCMediaListPlayer
+  - added selectors: initWithDrawable:
+                     initWithOptions:andDrawable:
+
 - VLCMedia
   - added keys: VLCMetaInformationTrackTotal, VLCMetaInformationDirector,
                 VLCMetaInformationSeason, VLCMetaInformationEpisode,

+ 15 - 2
Sources/VLCMediaListPlayer.m

@@ -42,7 +42,7 @@
 
 @implementation VLCMediaListPlayer
 
-- (instancetype)initWithOptions:(NSArray *)options
+- (instancetype)initWithOptions:(NSArray *)options andDrawable:(id)drawable
 {
     if (self = [super init]) {
         VLCLibrary *library;
@@ -52,14 +52,27 @@
             library = [VLCLibrary sharedLibrary];
 
         instance = libvlc_media_list_player_new([library instance]);
+
         _mediaPlayer = [[VLCMediaPlayer alloc] initWithLibVLCInstance:libvlc_media_list_player_get_media_player(instance) andLibrary:library];
+        if (drawable != nil)
+            [_mediaPlayer setDrawable:drawable];
     }
     return self;
 }
 
+- (instancetype)initWithOptions:(NSArray *)options
+{
+    return [self initWithOptions:options andDrawable:nil];
+}
+
 - (instancetype)init
 {
-    return [self initWithOptions:nil];
+    return [self initWithOptions:nil andDrawable:nil];
+}
+
+- (instancetype)initWithDrawable:(id)drawable
+{
+    return [self initWithOptions:nil andDrawable:drawable];
 }
 
 - (void)dealloc