VLCPlaybackController.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*****************************************************************************
  2. * VLCPlaybackController.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. NS_ASSUME_NONNULL_BEGIN
  15. extern NSString * const VLCPlaybackControllerPlaybackDidStart;
  16. extern NSString *const VLCPlaybackControllerPlaybackDidPause;
  17. extern NSString *const VLCPlaybackControllerPlaybackDidResume;
  18. extern NSString *const VLCPlaybackControllerPlaybackDidStop;
  19. extern NSString *const VLCPlaybackControllerPlaybackDidFail;
  20. extern NSString *const VLCPlaybackControllerPlaybackMetadataDidChange;
  21. extern NSString *const VLCPlaybackControllerPlaybackPositionUpdated;
  22. @class VLCPlaybackController;
  23. @class VLCMetaData;
  24. @class VLCDialogProvider;
  25. @class VLCMLMedia;
  26. @protocol VLCPlaybackControllerDelegate <NSObject>
  27. #if TARGET_OS_IOS
  28. - (void)savePlaybackState:(VLCPlaybackController *)controller;
  29. - (VLCMLMedia *_Nullable)mediaForPlayingMedia:(VLCMedia *)media;
  30. #endif
  31. @optional
  32. - (void)playbackPositionUpdated:(VLCPlaybackController *)controller;
  33. - (void)mediaPlayerStateChanged:(VLCMediaPlayerState)currentState
  34. isPlaying:(BOOL)isPlaying
  35. currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
  36. currentMediaHasChapters:(BOOL)currentMediaHasChapters
  37. forPlaybackController:(VLCPlaybackController *)controller;
  38. - (void)prepareForMediaPlayback:(VLCPlaybackController *)controller;
  39. - (void)showStatusMessage:(NSString *)statusMessage;
  40. - (void)displayMetadataForPlaybackController:(VLCPlaybackController *)controller metadata:(VLCMetaData *)metadata;
  41. @end
  42. @interface VLCPlaybackController : NSObject <VLCEqualizerViewDelegate>
  43. @property (nonatomic, strong, nullable) UIView *videoOutputView;
  44. @property (nonatomic, retain) VLCMediaList *mediaList;
  45. /* returns nil if currently playing item is not available,*/
  46. @property (nonatomic, strong, readonly) VLCMedia *currentlyPlayingMedia;
  47. @property (nonatomic, weak) id<VLCPlaybackControllerDelegate> delegate;
  48. @property (nonatomic, readonly) VLCMediaPlayerState mediaPlayerState;
  49. @property (nonatomic, readonly) VLCMetaData *metadata;
  50. @property (nonatomic, readonly) NSInteger mediaDuration;
  51. @property (nonatomic, readonly) BOOL isPlaying;
  52. @property (nonatomic, readonly) BOOL willPlay;
  53. @property (nonatomic, readonly) BOOL playerIsSetup;
  54. @property (nonatomic, readwrite) VLCRepeatMode repeatMode;
  55. @property (nonatomic, assign, getter=isShuffleMode) BOOL shuffleMode;
  56. @property (nonatomic, readwrite) float playbackRate; // default = 1.0
  57. @property (nonatomic, readwrite) float audioDelay; // in milliseconds, default = 0.0
  58. @property (nonatomic, readwrite) float playbackPosition; // in seconds, default = 0.0
  59. @property (nonatomic, readwrite) float subtitleDelay; // in milliseconds, default = 0.0
  60. @property (nonatomic, readwrite) float hue; // default = 0.0
  61. @property (nonatomic, readwrite) float contrast; // default = 1.0
  62. @property (nonatomic, readwrite) float brightness; // default = 1.0
  63. @property (nonatomic, readwrite) float saturation; // default = 1.0
  64. @property (nonatomic, readwrite) float gamma; // default = 1.0
  65. @property (nonatomic, readonly) CGFloat yaw; // between ]-180;180]
  66. @property (nonatomic, readonly) CGFloat pitch; // ]-90;90]
  67. @property (nonatomic, readonly) CGFloat roll; // ]-180;180]
  68. @property (nonatomic, readonly) CGFloat fov; // ]0;180[ (default 80.)
  69. @property (readonly) NSInteger indexOfCurrentAudioTrack;
  70. @property (readonly) NSInteger indexOfCurrentSubtitleTrack;
  71. @property (readonly) NSInteger indexOfCurrentTitle;
  72. @property (readonly) NSInteger indexOfCurrentChapter;
  73. @property (readonly) NSInteger numberOfAudioTracks;
  74. @property (readonly) NSInteger numberOfVideoSubtitlesIndexes;
  75. @property (readonly) NSInteger numberOfTitles;
  76. @property (readonly) NSInteger numberOfChaptersForCurrentTitle;
  77. @property (assign, readonly) BOOL currentMediaHasTrackToChooseFrom;
  78. @property (assign, readwrite) BOOL fullscreenSessionRequested;
  79. @property (assign, readonly) BOOL isSeekable;
  80. @property (assign, readonly) BOOL currentMediaIs360Video;
  81. @property (readonly) NSNumber *playbackTime;
  82. @property (nonatomic, readonly) NSDictionary *mediaOptionsDictionary;
  83. @property (nonatomic, readonly) NSTimer *sleepTimer;
  84. @property (nonatomic, readonly) VLCDialogProvider *dialogProvider;
  85. @property (nonatomic, nullable) VLCRendererItem *renderer;
  86. + (VLCPlaybackController *)sharedInstance;
  87. - (VLCTime *)playedTime;
  88. #pragma mark - playback
  89. - (void)startPlayback;
  90. - (void)stopPlayback;
  91. - (void)playPause;
  92. - (void)play;
  93. - (void)pause;
  94. - (void)next;
  95. - (void)previous;
  96. - (void)jumpForward:(int)interval;
  97. - (void)jumpBackward:(int)interval;
  98. - (void)toggleRepeatMode;
  99. - (void)resetFilters;
  100. - (VLCTime *)remainingTime;
  101. - (NSString *)audioTrackNameAtIndex:(NSInteger)index;
  102. - (NSString *)videoSubtitleNameAtIndex:(NSInteger)index;
  103. - (NSDictionary *)titleDescriptionsDictAtIndex:(NSInteger)index;
  104. - (NSDictionary *)chapterDescriptionsDictAtIndex:(NSInteger)index;
  105. - (void)selectAudioTrackAtIndex:(NSInteger)index;
  106. - (void)selectVideoSubtitleAtIndex:(NSInteger)index;
  107. - (void)selectTitleAtIndex:(NSInteger)index;
  108. - (void)selectChapterAtIndex:(NSInteger)index;
  109. - (void)setAudioPassthrough:(BOOL)shouldPass;
  110. - (void)switchAspectRatio;
  111. - (void)toggleFullScreen;
  112. #if !TARGET_OS_TV
  113. - (BOOL)updateViewpoint:(CGFloat)yaw pitch:(CGFloat)pitch roll:(CGFloat)roll fov:(CGFloat)fov absolute:(BOOL)absolute;
  114. - (NSInteger)currentMediaProjection;
  115. #endif
  116. - (void)recoverDisplayedMetadata;
  117. - (void)recoverPlaybackState;
  118. - (BOOL)isPlayingOnExternalScreen;
  119. - (void)setNeedsMetadataUpdate;
  120. - (void)scheduleSleepTimerWithInterval:(NSTimeInterval)timeInterval;
  121. - (void)performNavigationAction:(VLCMediaPlaybackNavigationAction)action;
  122. - (void)playMediaList:(VLCMediaList *)mediaList firstIndex:(NSInteger)index subtitlesFilePath:(nullable NSString *)subsFilePath;
  123. - (void)playMediaList:(VLCMediaList *)mediaList firstIndex:(NSInteger)index subtitlesFilePath:(nullable NSString *)subsFilePath completion:(void (^ __nullable)(BOOL success))completion;
  124. - (void)openVideoSubTitlesFromFile:(NSString *)pathToFile;
  125. NS_ASSUME_NONNULL_END
  126. @end