mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-06 13:12:49 +00:00
ASVideoNode property proxy
This commit is contained in:
@@ -33,6 +33,20 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@property (nonatomic, assign) BOOL disableControls;
|
||||
|
||||
#pragma mark - ASVideoNode property proxy
|
||||
/**
|
||||
* When shouldAutoplay is set to true, a video node will play when it has both loaded and entered the "visible" interfaceState.
|
||||
* If it leaves the visible interfaceState it will pause but will resume once it has returned.
|
||||
*/
|
||||
@property (nonatomic, assign, readwrite) BOOL shouldAutoplay;
|
||||
@property (nonatomic, assign, readwrite) BOOL shouldAutorepeat;
|
||||
@property (nonatomic, assign, readwrite) BOOL muted;
|
||||
@property (nonatomic, assign, readonly) ASVideoNodePlayerState playerState;
|
||||
//! Defaults to 100
|
||||
@property (nonatomic, assign) int32_t periodicTimeObserverTimescale;
|
||||
//! Defaults to AVLayerVideoGravityResizeAspect
|
||||
@property (atomic) NSString *gravity;
|
||||
|
||||
- (instancetype)initWithUrl:(NSURL*)url;
|
||||
- (instancetype)initWithAsset:(AVAsset*)asset;
|
||||
|
||||
|
||||
@@ -50,6 +50,12 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
||||
CMTime _duration;
|
||||
|
||||
BOOL _disableControls;
|
||||
|
||||
BOOL _shouldAutoplay;
|
||||
BOOL _shouldAutorepeat;
|
||||
BOOL _muted;
|
||||
int32_t _periodicTimeObserverTimescale;
|
||||
NSString *_gravity;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -535,6 +541,49 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setShouldAutoplay:(BOOL)shouldAutoplay
|
||||
{
|
||||
_shouldAutoplay = shouldAutoplay;
|
||||
_videoNode.shouldAutoplay = _shouldAutoplay;
|
||||
}
|
||||
|
||||
- (void)setShouldAutorepeat:(BOOL)shouldAutorepeat
|
||||
{
|
||||
_shouldAutorepeat = shouldAutorepeat;
|
||||
_videoNode.shouldAutorepeat = YES;
|
||||
}
|
||||
|
||||
- (void)setMuted:(BOOL)muted
|
||||
{
|
||||
_muted = muted;
|
||||
_videoNode.muted = _muted;
|
||||
}
|
||||
|
||||
- (void)setPeriodicTimeObserverTimescale:(int32_t)periodicTimeObserverTimescale
|
||||
{
|
||||
_periodicTimeObserverTimescale = periodicTimeObserverTimescale;
|
||||
_videoNode.periodicTimeObserverTimescale = _periodicTimeObserverTimescale;
|
||||
}
|
||||
|
||||
- (NSString*)gravity
|
||||
{
|
||||
if (_gravity == nil) {
|
||||
_gravity = _videoNode.gravity;
|
||||
}
|
||||
return _gravity;
|
||||
}
|
||||
|
||||
- (void)setGravity:(NSString *)gravity
|
||||
{
|
||||
_gravity = gravity;
|
||||
_videoNode.gravity = _gravity;
|
||||
}
|
||||
|
||||
- (ASVideoNodePlayerState)playerState
|
||||
{
|
||||
return _videoNode.playerState;
|
||||
}
|
||||
|
||||
#pragma mark - Helpers
|
||||
- (NSString *)timeStringForCMTime:(CMTime)time forTimeLabelType:(ASVideoPlayerNodeControlType)type
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user