JubeatPlus 3.9.11
Loading...
Searching...
No Matches
VideoView.h
Go to the documentation of this file.
1
18
19#import <AVFoundation/AVFoundation.h>
20#import <UIKit/UIKit.h>
21
22@class GradationView;
23@class VideoView;
24
25NS_ASSUME_NONNULL_BEGIN
26
32@protocol VideoViewDelegate <NSObject>
33@optional
38- (void)viewReady:(nullable VideoView *)view;
40- (void)movieReady;
42- (void)movieStart;
44- (void)movieEnd;
50- (void)movieError;
57- (void)closeNotice:(nullable VideoView *)view;
62- (void)storeNotice:(nullable VideoView *)view;
63@end
64
68@interface VideoView : UIView
69
76@property(assign, nonatomic, nullable) id<VideoViewDelegate> delegate;
78@property(strong, nonatomic, nullable) AVPlayer *player;
80@property(strong, nonatomic, nullable) AVPlayerLayer *playerLayer;
82@property(strong, nonatomic, nullable) AVPlayerItem *playerItem;
84@property(strong, nonatomic, nullable) UIView *memuView;
86@property(strong, nonatomic, nullable) GradationView *gradationTopView;
89@property(strong, nonatomic, nullable) GradationView *gradationButtomView;
96@property(assign, nonatomic) int menuStatus;
98@property(strong, nonatomic, nullable) UILabel *currentTimeLabel;
100@property(strong, nonatomic, nullable) UIButton *backButton;
102@property(strong, nonatomic, nullable) UIButton *storeButton;
104@property(strong, nonatomic, nullable) UIButton *soundButton;
106@property(strong, nonatomic, nullable) UIButton *playButton;
108@property(strong, nonatomic, nullable) UIImageView *posterImg;
110@property(strong, nonatomic, nullable) id playTimeObserver;
112@property(strong, nonatomic, nullable) dispatch_source_t timerSource;
114@property(assign, nonatomic) BOOL errorFlg;
116@property(assign, nonatomic) BOOL playFlg;
118@property(assign, nonatomic) BOOL autoPlayFlg;
119
126- (instancetype)initWithFrame:(CGRect)frame;
127
132- (void)setAutoPlay;
133
141- (void)setMovieUrl:(nullable NSString *)movieUrl
142 posterUrl:(nullable NSString *)posterUrl
143 movieVoiceFlg:(nullable NSString *)movieVoiceFlg;
144
150- (void)setPosterImgWithUrl:(nullable NSString *)url;
151
156- (void)backAction;
157
163- (void)soundAction:(nullable UIButton *)sender;
164
169- (void)storeAction;
170
176- (void)playAction:(nullable UIButton *)sender;
177
183- (void)skipAction:(nullable id)sender;
184
189- (void)repeat;
190
195- (void)pause;
196
201- (void)finish;
202
211- (void)observeValueForKeyPath:(nullable NSString *)keyPath
212 ofObject:(nullable id)object
213 change:(nullable NSDictionary *)change
214 context:(nullable void *)context;
215
221- (void)playerDidPlayToEndTime:(nullable NSNotification *)notification;
222
227- (void)setupTimer;
228
233- (void)syncTimeRemaining;
234
239- (void)pauseCheck;
240
247- (nullable NSString *)timeToString:(float)time;
248
253- (void)setCacheTimer;
254
259- (void)pauseTimer;
260
265- (void)cancelTimer;
266
272- (double)availableDuration;
273
280- (void)touchesBegan:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event;
281
286- (void)menuOn;
287
292- (void)menuOff;
293
299
305
310- (void)streamingError;
311
316- (void)openErrorNotice;
317
323
328- (void)appStoreCloseNotice;
329
335
341- (void)appStoreFailLoadNoticeWithError:(nullable NSError *)error;
342
348
353- (void)deallocPlayer;
354
359- (void)clearDelegate;
360
361@end
362
363NS_ASSUME_NONNULL_END
364
365// code: language=Objective-C
366// kate: hl Objective-C;
367// vim: set ft=objc :
A vertical gradient between two colours, drawn top to bottom.
Definition GradationView.h:22
An AVPlayer-backed advert-video view with a touch-revealed menu overlay.
Definition VideoView.h:69
GradationView * gradationButtomView
The bottom gradient strip that hosts the store button.
Definition VideoView.h:89
UIButton * backButton
The back button.
Definition VideoView.h:100
void setCacheTimer()
Creates and starts the GCD timer that polls the cached duration twice a second.
Definition VideoView.m:685
AVPlayer * player
The player driving playback.
Definition VideoView.h:78
AVPlayerItem * playerItem
The current item being played.
Definition VideoView.h:82
void clearDelegate()
Clears the delegate pointer.
Definition VideoView.m:923
void menuOn()
Fades the menu overlay in.
Definition VideoView.m:792
UIButton * soundButton
The sound-state indicator (a UIButton with user interaction disabled).
Definition VideoView.h:104
id< VideoViewDelegate > delegate
The lifecycle delegate.
Definition VideoView.h:76
UIButton * playButton
The play/pause button.
Definition VideoView.h:106
dispatch_source_t timerSource
The GCD timer source that polls the cached duration.
Definition VideoView.h:112
void openErrorNotice()
Store lifecycle notice stub (empty in the binary).
Definition VideoView.m:873
void finish()
Pauses, hides the play button, and pins the menu on (finished state).
Definition VideoView.m:565
void pauseTimer()
Suspends the cache timer if it is running.
Definition VideoView.m:706
void syncTimeRemaining()
Refreshes the remaining-time label and reschedules the pause check.
Definition VideoView.m:651
void backAction()
Tears the player down and reports -closeNotice: to the delegate.
Definition VideoView.m:490
void setupTimer()
Installs the periodic remaining-time observer and refreshes the readout once.
Definition VideoView.m:634
void storeAction()
Pauses playback and reports -storeNotice: to the delegate.
Definition VideoView.m:509
BOOL autoPlayFlg
Set when the movie should auto-start as soon as it is ready.
Definition VideoView.h:118
void pause()
Pauses playback and deselects the play button.
Definition VideoView.m:559
void appStoreOpenedNotice()
Store lifecycle notice stub (empty in the binary).
Definition VideoView.m:877
BOOL playFlg
Set once the movie has started playing.
Definition VideoView.h:116
void setAutoPlay()
Marks the view to auto-start playback once the movie is ready.
Definition VideoView.m:375
int menuStatus
The menu overlay state.
Definition VideoView.h:96
id playTimeObserver
The token returned by -addPeriodicTimeObserverForInterval:queue:usingBlock: .
Definition VideoView.h:110
void repeat()
Seeks to the start, replays, and reports -movieStart to the delegate.
Definition VideoView.m:548
void streamingTimeoutNowCheck()
Fires a streaming error if playback still has not begun when the watchdog elapses.
Definition VideoView.m:848
UIButton * storeButton
The store button.
Definition VideoView.h:102
AVPlayerLayer * playerLayer
The layer that renders the player's video.
Definition VideoView.h:80
void appStoreTransitionNotice()
Store lifecycle notice stub (empty in the binary).
Definition VideoView.m:893
void menuOff()
Fades the menu overlay out (only while playing and not in the error or finished state).
Definition VideoView.m:812
void streamingTimeoutWatch()
Arms the streaming-timeout watchdog.
Definition VideoView.m:838
double availableDuration()
Polls how much of the movie has buffered, revealing the play button and firing cache-end.
Definition VideoView.m:726
UIImageView * posterImg
The poster image shown before playback begins.
Definition VideoView.h:108
void appStoreClosedNotice()
Store lifecycle notice stub (empty in the binary).
Definition VideoView.m:885
void cancelTimer()
Cancels and releases the cache timer and any pending timeout check.
Definition VideoView.m:713
void pauseCheck()
Pauses if the play button is currently selected.
Definition VideoView.m:666
void appStoreCloseNotice()
Store lifecycle notice stub (empty in the binary).
Definition VideoView.m:881
void deallocPlayer()
Cancels the timer, removes observers, and releases the player, layer, and item.
Definition VideoView.m:899
UILabel * currentTimeLabel
The label showing the remaining play time.
Definition VideoView.h:98
void streamingError()
Reports the streaming error, tears the player down, and shows the error overlay.
Definition VideoView.m:855
UIView * memuView
The menu overlay container.
Definition VideoView.h:84
GradationView * gradationTopView
The top gradient strip that hosts the back, sound, and time controls.
Definition VideoView.h:86
BOOL errorFlg
Set once a streaming error has been shown, to suppress a second overlay.
Definition VideoView.h:114
void movieAutoStartError()
The movie could not auto-start because it was not yet cached.
void movieError()
The movie could not stream (timeout or buffer stall).
void movieReady()
The movie became ready to play.
void movieEnd()
The movie stopped at its end (or was skipped).
void movieCacheEnd()
The movie finished buffering to the cache.
void movieStart()
The movie started playing.
void movieSoundUse()
The movie is playing with sound.