VLCPlaybackService.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*****************************************************************************
  2. * VLCPlaybackService.h
  3. * VLC for iOS
  4. *****************************************************************************
  5. * Copyright (c) 2013-2015 VideoLAN. All rights reserved.
  6. * $Id$
  7. *
  8. * Authors: Felix Paul Kühne <fkuehne # videolan.org>
  9. * Tobias Conradi <videolan # tobias-conradi.de>
  10. *
  11. * Refer to the COPYING file of the official project for license.
  12. *****************************************************************************/
  13. #import "VLCEqualizerView.h"
  14. typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
  15. VLCAspectRatioDefault = 0,
  16. VLCAspectRatioFillToScreen,
  17. VLCAspectRatioFourToThree,
  18. VLCAspectRatioSixteenToNine,
  19. VLCAspectRatioSixteenToTen,
  20. };
  21. NS_ASSUME_NONNULL_BEGIN
  22. extern NSString *const VLCPlaybackServicePlaybackDidStart;
  23. extern NSString *const VLCPlaybackServicePlaybackDidPause;
  24. extern NSString *const VLCPlaybackServicePlaybackDidResume;
  25. extern NSString *const VLCPlaybackServicePlaybackDidStop;
  26. extern NSString *const VLCPlaybackServicePlaybackDidFail;
  27. extern NSString *const VLCPlaybackServicePlaybackMetadataDidChange;
  28. extern NSString *const VLCPlaybackServicePlaybackPositionUpdated;
  29. @class VLCPlaybackService;
  30. @class VLCMetaData;
  31. @class VLCDialogProvider;
  32. @class VLCMLMedia;
  33. @class VLCPlayerDisplayController;
  34. @protocol VLCPlaybackServiceDelegate <NSObject>
  35. #if TARGET_OS_IOS
  36. - (void)savePlaybackState:(VLCPlaybackService *)playbackService;
  37. - (VLCMLMedia *_Nullable)mediaForPlayingMedia:(VLCMedia *)media;
  38. #endif
  39. @optional
  40. - (void)playbackPositionUpdated:(VLCPlaybackService *)playbackService;
  41. - (void)mediaPlayerStateChanged:(VLCMediaPlayerState)currentState
  42. isPlaying:(BOOL)isPlaying
  43. currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
  44. currentMediaHasChapters:(BOOL)currentMediaHasChapters
  45. forPlaybackService:(VLCPlaybackService *)playbackService;
  46. - (void)prepareForMediaPlayback:(VLCPlaybackService *)playbackService;
  47. - (void)showStatusMessage:(NSString *)statusMessage;
  48. - (void)displayMetadataForPlaybackService:(VLCPlaybackService *)playbackService
  49. metadata:(VLCMetaData *)metadata;
  50. - (void)playbackServiceDidSwitchAspectRatio:(VLCAspectRatio)aspectRatio;
  51. @end
  52. NS_SWIFT_NAME(PlaybackService)
  53. @interface VLCPlaybackService : NSObject <VLCEqualizerViewDelegate>
  54. @property (nonatomic, strong, nullable) UIView *videoOutputView;
  55. @property (nonatomic, retain) VLCMediaList *mediaList;
  56. /* returns nil if currently playing item is not available,*/
  57. @property (nonatomic, strong, readonly) VLCMedia *currentlyPlayingMedia;
  58. @property (nonatomic, weak) id<VLCPlaybackServiceDelegate> delegate;
  59. @property (nonatomic, readonly) VLCMediaPlayerState mediaPlayerState;
  60. @property (nonatomic, readonly) VLCMetaData *metadata;
  61. @property (nonatomic, readonly) NSInteger mediaDuration;
  62. @property (nonatomic, readonly) BOOL isPlaying;
  63. @property (nonatomic, readonly) BOOL willPlay;
  64. @property (nonatomic, readonly) BOOL playerIsSetup;
  65. @property (nonatomic, readwrite) VLCRepeatMode repeatMode;
  66. @property (nonatomic, assign, getter=isShuffleMode) BOOL shuffleMode;
  67. @property (nonatomic, readwrite) float playbackRate; // default = 1.0
  68. @property (nonatomic, readwrite) float audioDelay; // in milliseconds, default = 0.0
  69. @property (nonatomic, readwrite) float playbackPosition; // in seconds, default = 0.0
  70. @property (nonatomic, readwrite) float subtitleDelay; // in milliseconds, default = 0.0
  71. @property (nonatomic, readwrite) float hue; // default = 0.0
  72. @property (nonatomic, readwrite) float contrast; // default = 1.0
  73. @property (nonatomic, readwrite) float brightness; // default = 1.0
  74. @property (nonatomic, readwrite) float saturation; // default = 1.0
  75. @property (nonatomic, readwrite) float gamma; // default = 1.0
  76. @property (nonatomic, readonly) CGFloat yaw; // between ]-180;180]
  77. @property (nonatomic, readonly) CGFloat pitch; // ]-90;90]
  78. @property (nonatomic, readonly) CGFloat roll; // ]-180;180]
  79. @property (nonatomic, readonly) CGFloat fov; // ]0;180[ (default 80.)
  80. @property (readonly) NSInteger indexOfCurrentAudioTrack;
  81. @property (readonly) NSInteger indexOfCurrentSubtitleTrack;
  82. @property (readonly) NSInteger indexOfCurrentTitle;
  83. @property (readonly) NSInteger indexOfCurrentChapter;
  84. @property (readonly) NSInteger numberOfAudioTracks;
  85. @property (readonly) NSInteger numberOfVideoSubtitlesIndexes;
  86. @property (readonly) NSInteger numberOfTitles;
  87. @property (readonly) NSInteger numberOfChaptersForCurrentTitle;
  88. @property (assign, readonly) BOOL currentMediaHasTrackToChooseFrom;
  89. @property (assign, readwrite) BOOL fullscreenSessionRequested;
  90. @property (assign, readonly) BOOL isSeekable;
  91. @property (assign, readonly) BOOL currentMediaIs360Video;
  92. @property (readonly) NSNumber *playbackTime;
  93. @property (nonatomic, readonly) NSDictionary *mediaOptionsDictionary;
  94. @property (nonatomic, readonly) NSTimer *sleepTimer;
  95. @property (nonatomic, readonly) VLCDialogProvider *dialogProvider;
  96. @property (nonatomic, nullable) VLCRendererItem *renderer;
  97. @property (nonatomic, readonly) VLCAspectRatio currentAspectRatio;
  98. + (VLCPlaybackService *)sharedInstance;
  99. - (VLCTime *)playedTime;
  100. #pragma mark - playback
  101. - (void)startPlayback;
  102. - (void)stopPlayback;
  103. - (void)playPause;
  104. - (void)play;
  105. - (void)pause;
  106. - (void)next;
  107. - (void)previous;
  108. - (void)jumpForward:(int)interval;
  109. - (void)jumpBackward:(int)interval;
  110. - (void)toggleRepeatMode;
  111. - (void)resetFilters;
  112. - (VLCTime *)remainingTime;
  113. - (NSString *)audioTrackNameAtIndex:(NSInteger)index;
  114. - (NSString *)videoSubtitleNameAtIndex:(NSInteger)index;
  115. - (NSDictionary *)titleDescriptionsDictAtIndex:(NSInteger)index;
  116. - (NSDictionary *)chapterDescriptionsDictAtIndex:(NSInteger)index;
  117. - (void)selectAudioTrackAtIndex:(NSInteger)index;
  118. - (void)selectVideoSubtitleAtIndex:(NSInteger)index;
  119. - (void)selectTitleAtIndex:(NSInteger)index;
  120. - (void)selectChapterAtIndex:(NSInteger)index;
  121. - (void)setAudioPassthrough:(BOOL)shouldPass;
  122. - (void)switchAspectRatio:(BOOL)toggleFullScreen;
  123. #if !TARGET_OS_TV
  124. - (BOOL)updateViewpoint:(CGFloat)yaw pitch:(CGFloat)pitch roll:(CGFloat)roll fov:(CGFloat)fov absolute:(BOOL)absolute;
  125. - (NSInteger)currentMediaProjection;
  126. #endif
  127. - (void)recoverDisplayedMetadata;
  128. - (void)recoverPlaybackState;
  129. - (BOOL)isPlayingOnExternalScreen;
  130. - (void)setPlayerHidden:(BOOL)hidden;
  131. - (void)setPlayerDisplayController:(VLCPlayerDisplayController *)playerDisplayController;
  132. - (void)setNeedsMetadataUpdate;
  133. - (void)scheduleSleepTimerWithInterval:(NSTimeInterval)timeInterval;
  134. - (void)performNavigationAction:(VLCMediaPlaybackNavigationAction)action;
  135. - (void)playMediaList:(VLCMediaList *)mediaList firstIndex:(NSInteger)index subtitlesFilePath:(nullable NSString *)subsFilePath;
  136. - (void)playMediaList:(VLCMediaList *)mediaList firstIndex:(NSInteger)index subtitlesFilePath:(nullable NSString *)subsFilePath completion:(void (^ __nullable)(BOOL success))completion;
  137. - (void)openVideoSubTitlesFromFile:(NSString *)pathToFile;
  138. NS_ASSUME_NONNULL_END
  139. @end