mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
coding style fixes
This commit is contained in:
@@ -117,7 +117,7 @@ static NSString * const kStatus = @"status";
|
|||||||
if (_asset != nil) {
|
if (_asset != nil) {
|
||||||
return [[AVPlayerItem alloc] initWithAsset:_asset];
|
return [[AVPlayerItem alloc] initWithAsset:_asset];
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ static NSString * const kStatus = @"status";
|
|||||||
if (_placeholderImageNode.image == nil) {
|
if (_placeholderImageNode.image == nil) {
|
||||||
[self generatePlaceholderImage];
|
[self generatePlaceholderImage];
|
||||||
}
|
}
|
||||||
if(_shouldBePlaying) {
|
if (_shouldBePlaying) {
|
||||||
self.playerState = ASVideoNodePlayerStatePlaying;
|
self.playerState = ASVideoNodePlayerStatePlaying;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -334,7 +334,7 @@ static NSString * const kStatus = @"status";
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_delegateFlags.delegateVideoNodeDidPlayToSecond){
|
if (_delegateFlags.delegateVideoNodeDidPlayToSecond) {
|
||||||
[_delegate videoNode:self didPlayToSecond:timeInSeconds];
|
[_delegate videoNode:self didPlayToSecond:timeInSeconds];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,11 +344,11 @@ static NSString * const kStatus = @"status";
|
|||||||
[super clearFetchedData];
|
[super clearFetchedData];
|
||||||
|
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_videoLock);
|
ASDN::MutexLocker l(_videoLock);
|
||||||
|
|
||||||
self.player = nil;
|
self.player = nil;
|
||||||
self.currentItem = nil;
|
self.currentItem = nil;
|
||||||
_placeholderImageNode.image = nil;
|
_placeholderImageNode.image = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ static NSString * const kStatus = @"status";
|
|||||||
|
|
||||||
ASVideoNodePlayerState oldState = _playerState;
|
ASVideoNodePlayerState oldState = _playerState;
|
||||||
|
|
||||||
if(oldState == playerState) {
|
if (oldState == playerState) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,7 +447,7 @@ static NSString * const kStatus = @"status";
|
|||||||
- (void)setDelegate:(id<ASVideoNodeDelegate>)delegate
|
- (void)setDelegate:(id<ASVideoNodeDelegate>)delegate
|
||||||
{
|
{
|
||||||
_delegate = delegate;
|
_delegate = delegate;
|
||||||
if(_delegate == nil) {
|
if (_delegate == nil) {
|
||||||
memset(&_delegateFlags, 0, sizeof(_delegateFlags));
|
memset(&_delegateFlags, 0, sizeof(_delegateFlags));
|
||||||
} else {
|
} else {
|
||||||
_delegateFlags.delegateVideNodeShouldChangePlayerStateTo = [_delegate respondsToSelector:@selector(videoNode:shouldChangePlayerStateTo:)];
|
_delegateFlags.delegateVideNodeShouldChangePlayerStateTo = [_delegate respondsToSelector:@selector(videoNode:shouldChangePlayerStateTo:)];
|
||||||
@@ -496,7 +496,7 @@ static NSString * const kStatus = @"status";
|
|||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_videoLock);
|
ASDN::MutexLocker l(_videoLock);
|
||||||
|
|
||||||
if(![self isStateChangeValid:ASVideoNodePlayerStatePlaying]){
|
if (![self isStateChangeValid:ASVideoNodePlayerStatePlaying]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ static NSString * const kStatus = @"status";
|
|||||||
}];
|
}];
|
||||||
if (![self ready]) {
|
if (![self ready]) {
|
||||||
[self showSpinner];
|
[self showSpinner];
|
||||||
}else{
|
} else {
|
||||||
[self removeSpinner];
|
[self removeSpinner];
|
||||||
self.playerState = ASVideoNodePlayerStatePlaying;
|
self.playerState = ASVideoNodePlayerStatePlaying;
|
||||||
}
|
}
|
||||||
@@ -555,7 +555,7 @@ static NSString * const kStatus = @"status";
|
|||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_videoLock);
|
ASDN::MutexLocker l(_videoLock);
|
||||||
|
|
||||||
if(!_spinner) {
|
if (!_spinner) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
[_spinner removeFromSupernode];
|
[_spinner removeFromSupernode];
|
||||||
@@ -565,7 +565,7 @@ static NSString * const kStatus = @"status";
|
|||||||
- (void)pause
|
- (void)pause
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_videoLock);
|
ASDN::MutexLocker l(_videoLock);
|
||||||
if(![self isStateChangeValid:ASVideoNodePlayerStatePaused]){
|
if (![self isStateChangeValid:ASVideoNodePlayerStatePaused]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.playerState = ASVideoNodePlayerStatePaused;
|
self.playerState = ASVideoNodePlayerStatePaused;
|
||||||
@@ -586,8 +586,8 @@ static NSString * const kStatus = @"status";
|
|||||||
|
|
||||||
- (BOOL)isStateChangeValid:(ASVideoNodePlayerState)state
|
- (BOOL)isStateChangeValid:(ASVideoNodePlayerState)state
|
||||||
{
|
{
|
||||||
if(_delegateFlags.delegateVideNodeShouldChangePlayerStateTo){
|
if (_delegateFlags.delegateVideNodeShouldChangePlayerStateTo) {
|
||||||
if(![_delegate videoNode:self shouldChangePlayerStateTo:state]){
|
if (![_delegate videoNode:self shouldChangePlayerStateTo:state]) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#import "ViewController.h"
|
#import "ViewController.h"
|
||||||
|
|
||||||
@interface ViewController()<ASVideoNodeDelegate>
|
@interface ViewController()<ASVideoNodeDelegate>
|
||||||
@property (nonatomic,strong) ASVideoNode *guitarVideoNode;
|
@property (nonatomic, strong) ASVideoNode *guitarVideoNode;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation ViewController
|
@implementation ViewController
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
- (ASVideoNode *)guitarVideoNode;
|
- (ASVideoNode *)guitarVideoNode;
|
||||||
{
|
{
|
||||||
if(_guitarVideoNode){
|
if (_guitarVideoNode) {
|
||||||
return _guitarVideoNode;
|
return _guitarVideoNode;
|
||||||
}
|
}
|
||||||
_guitarVideoNode = [[ASVideoNode alloc] init];
|
_guitarVideoNode = [[ASVideoNode alloc] init];
|
||||||
@@ -107,12 +107,12 @@
|
|||||||
|
|
||||||
- (void)videoNodeWasTapped:(ASVideoNode *)videoNode
|
- (void)videoNodeWasTapped:(ASVideoNode *)videoNode
|
||||||
{
|
{
|
||||||
if(videoNode == self.guitarVideoNode){
|
if (videoNode == self.guitarVideoNode) {
|
||||||
if(videoNode.playerState == ASVideoNodePlayerStatePlaying){
|
if (videoNode.playerState == ASVideoNodePlayerStatePlaying) {
|
||||||
[videoNode pause];
|
[videoNode pause];
|
||||||
}else if(videoNode.playerState == ASVideoNodePlayerStateLoading) {
|
} else if(videoNode.playerState == ASVideoNodePlayerStateLoading) {
|
||||||
[videoNode pause];
|
[videoNode pause];
|
||||||
}else{
|
} else {
|
||||||
[videoNode play];
|
[videoNode play];
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -125,23 +125,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - ASVideoNodeDelegate
|
#pragma mark - ASVideoNodeDelegate
|
||||||
- (void)videoNode:(ASVideoNode *)videoNode willChangePlayerState:(ASVideoNodePlayerState)state toState:(ASVideoNodePlayerState)toSate{
|
- (void)videoNode:(ASVideoNode *)videoNode willChangePlayerState:(ASVideoNodePlayerState)state toState:(ASVideoNodePlayerState)toSate
|
||||||
|
{
|
||||||
//Ignore nicCageVideo
|
//Ignore nicCageVideo
|
||||||
if(videoNode != _guitarVideoNode){
|
if (videoNode != _guitarVideoNode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(toSate == ASVideoNodePlayerStatePlaying){
|
if (toSate == ASVideoNodePlayerStatePlaying) {
|
||||||
NSLog(@"guitarVideoNode is playing");
|
NSLog(@"guitarVideoNode is playing");
|
||||||
}else if(toSate == ASVideoNodePlayerStateFinished){
|
} else if (toSate == ASVideoNodePlayerStateFinished) {
|
||||||
NSLog(@"guitarVideoNode finished");
|
NSLog(@"guitarVideoNode finished");
|
||||||
}else if(toSate == ASVideoNodePlayerStateLoading){
|
} else if (toSate == ASVideoNodePlayerStateLoading) {
|
||||||
NSLog(@"guitarVideoNode is buffering");
|
NSLog(@"guitarVideoNode is buffering");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)videoNode:(ASVideoNode *)videoNode didPlayToSecond:(NSTimeInterval)second{
|
- (void)videoNode:(ASVideoNode *)videoNode didPlayToSecond:(NSTimeInterval)second
|
||||||
if(videoNode != _guitarVideoNode){
|
{
|
||||||
|
if (videoNode != _guitarVideoNode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user