Skip to content

Commit

Permalink
Release 3.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
changsanjiang committed Jul 14, 2022
1 parent 4e7350e commit 7523d5a
Show file tree
Hide file tree
Showing 14 changed files with 848 additions and 804 deletions.
16 changes: 8 additions & 8 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,20 @@ PODS:
- SJUIKit/UIMaker (0.0.0.58):
- SJUIKit/UIMaker/Core (= 0.0.0.58)
- SJUIKit/UIMaker/Core (0.0.0.58)
- SJVideoPlayer (3.4.0):
- SJVideoPlayer (3.4.1):
- SJBaseVideoPlayer (>= 3.7.0)
- SJVideoPlayer/Common (= 3.4.0)
- SJVideoPlayer/ControlLayers (= 3.4.0)
- SJVideoPlayer/ResourceLoader (= 3.4.0)
- SJVideoPlayer/Common (3.4.0):
- SJVideoPlayer/Common (= 3.4.1)
- SJVideoPlayer/ControlLayers (= 3.4.1)
- SJVideoPlayer/ResourceLoader (= 3.4.1)
- SJVideoPlayer/Common (3.4.1):
- Masonry
- SJBaseVideoPlayer (>= 3.7.0)
- SJUIKit/AttributesFactory
- SJVideoPlayer/ResourceLoader
- SJVideoPlayer/ControlLayers (3.4.0):
- SJVideoPlayer/ControlLayers (3.4.1):
- SJBaseVideoPlayer (>= 3.7.0)
- SJVideoPlayer/Common
- SJVideoPlayer/ResourceLoader (3.4.0):
- SJVideoPlayer/ResourceLoader (3.4.1):
- SJBaseVideoPlayer (>= 3.7.0)
- YYModel (1.0.4)

Expand Down Expand Up @@ -159,7 +159,7 @@ SPEC CHECKSUMS:
SJMediaCacheServer: 95bebce42f281fccaff25a5e8284022478ff7ba5
SJRouter: a866e7884fc9219bed523be0a0318c3a84e85022
SJUIKit: 86d5b16f8b8b17274ef8805acf965e4014629e15
SJVideoPlayer: 583387d58278db0e9e56122066425fb05fd84ec7
SJVideoPlayer: de6f7b1d192711840a672716c0237b7f6af642bf
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30

PODFILE CHECKSUM: 806121bb2fec366be255af4703b69f0a92bb11e3
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Example/Pods/Local Podspecs/SJVideoPlayer.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Example/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,504 changes: 754 additions & 750 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file not shown.
2 changes: 1 addition & 1 deletion SJVideoPlayer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.platform = :ios, '9.0'
s.source = { :git => 'https://github.com/changsanjiang/SJVideoPlayer.git', :tag => "v#{s.version}" }
s.requires_arc = true
s.dependency 'SJBaseVideoPlayer', '>= 3.7.0'
s.dependency 'SJBaseVideoPlayer', '>= 3.7.1'

s.source_files = 'SJVideoPlayer/*.{h,m}'

Expand Down
13 changes: 13 additions & 0 deletions SJVideoPlayer/Common/Utils/Adapters/Core/SJEdgeControlButtonItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "SJEdgeControlButtonItem.h"
#import "SJEdgeControlButtonItemInternal.h"
#import <objc/message.h>

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -17,6 +18,7 @@ @implementation SJEdgeControlButtonItem {
CGFloat _size;
BOOL _isFrameLayout;
NSMutableArray<SJEdgeControlButtonItemAction *> *_Nullable _actions;
BOOL _innerHidden;
}
- (instancetype)initWithTitle:(nullable NSAttributedString *)title
target:(nullable id)target
Expand Down Expand Up @@ -94,6 +96,17 @@ - (void)performActions {
}
[NSNotificationCenter.defaultCenter postNotificationName:SJEdgeControlButtonItemPerformedActionNotification object:self];
}

- (void)setInnerHidden:(BOOL)innerHidden {
_innerHidden = innerHidden;
}
- (BOOL)isInnerHidden {
return _innerHidden;
}

- (BOOL)isHidden {
return _hidden || _innerHidden;
}
@end


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// SJEdgeControlButtonItemInternal.h
// Pods
//
// Created by 畅三江 on 2022/7/14.
//

#import "SJEdgeControlButtonItem.h"

NS_ASSUME_NONNULL_BEGIN
@interface SJEdgeControlButtonItem (SJInternal)
@property (nonatomic, getter=isInnerHidden) BOOL innerHidden; // 是否被sdk内部设置隐藏了;
@end
NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#import "SJControlLayerSwitcher.h"
#import "SJVideoPlayerConfigurations.h"

#import "SJEdgeControlButtonItemInternal.h"

NS_ASSUME_NONNULL_BEGIN
// right items
static SJEdgeControlButtonItemTag SJClipsControlLayerRightItem_Screenshot = 10000;
Expand Down Expand Up @@ -170,15 +172,15 @@ - (void)_updateRightItemSettings {
id<SJVideoPlayerControlLayerResources> sources = SJVideoPlayerConfigurations.shared.resources;
SJEdgeControlButtonItem *screenshotItem = [self.rightAdapter itemForTag:SJClipsControlLayerRightItem_Screenshot];
screenshotItem.image = sources.screenshotImage;
screenshotItem.hidden = _config.disableScreenshot;
screenshotItem.innerHidden = _config.disableScreenshot;

SJEdgeControlButtonItem *exportVideoItem = [self.rightAdapter itemForTag:SJClipsControlLayerRightItem_ExportVideo];
exportVideoItem.image = sources.videoClipImage;
exportVideoItem.hidden = _config.disableRecord;
exportVideoItem.innerHidden = _config.disableRecord;

SJEdgeControlButtonItem *exportGIFItem = [self.rightAdapter itemForTag:SJClipsControlLayerRightItem_ExportGIF];
exportGIFItem.image = sources.GIFClipImage;
exportGIFItem.hidden = _config.disableGIF;
exportGIFItem.innerHidden = _config.disableGIF;

[self.rightAdapter reload];
}
Expand Down
59 changes: 32 additions & 27 deletions SJVideoPlayer/ControlLayers/SJEdgeControlLayer/SJEdgeControlLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#import "SJScrollingTextMarqueeView.h"
#import "SJFullscreenModeStatusBar.h"
#import "SJSpeedupPlaybackPopupView.h"
#import "SJEdgeControlButtonItemInternal.h"
#import <objc/message.h>

#pragma mark - Top
Expand Down Expand Up @@ -219,8 +220,11 @@ - (void)installedControlViewToVideoPlayer:(__kindof SJBaseVideoPlayer *)videoPla
///
- (BOOL)controlLayerOfVideoPlayerCanAutomaticallyDisappear:(__kindof SJBaseVideoPlayer *)videoPlayer {
SJEdgeControlButtonItem *progressItem = [_bottomAdapter itemForTag:SJEdgeControlLayerBottomItem_Progress];
SJProgressSlider *slider = progressItem.customView;
return !slider.isDragging;
if ( progressItem != nil && !progressItem.isHidden ) {
SJProgressSlider *slider = progressItem.customView;
return !slider.isDragging;
}
return YES;
}

- (void)controlLayerNeedAppear:(__kindof SJBaseVideoPlayer *)videoPlayer {
Expand Down Expand Up @@ -300,22 +304,21 @@ - (void)videoPlayer:(__kindof SJBaseVideoPlayer *)videoPlayer playbackTypeDidCha
SJEdgeControlButtonItem *liveItem = [_bottomAdapter itemForTag:SJEdgeControlLayerBottomItem_LIVEText];
switch ( playbackType ) {
case SJPlaybackTypeLIVE: {
currentTimeItem.hidden = YES;
separatorItem.hidden = YES;
durationTimeItem.hidden = YES;
progressItem.hidden = YES;
liveItem.hidden = NO;
currentTimeItem.innerHidden = YES;
separatorItem.innerHidden = YES;
durationTimeItem.innerHidden = YES;
progressItem.innerHidden = YES;
liveItem.innerHidden = NO;
}
break;
case SJPlaybackTypeUnknown:
case SJPlaybackTypeVOD:
case SJPlaybackTypeFILE: {
currentTimeItem.hidden = NO;
separatorItem.hidden = NO;
durationTimeItem.hidden = NO;
progressItem.hidden = NO;
liveItem.hidden = YES;
[_bottomAdapter removeItemForTag:SJEdgeControlLayerBottomItem_LIVEText];
currentTimeItem.innerHidden = NO;
separatorItem.innerHidden = NO;
durationTimeItem.innerHidden = NO;
progressItem.innerHidden = NO;
liveItem.innerHidden = YES;
}
break;
}
Expand Down Expand Up @@ -795,7 +798,7 @@ - (void)_addItemsToBottomAdapter {
[self.bottomAdapter addItem:playItem];

SJEdgeControlButtonItem *liveItem = [[SJEdgeControlButtonItem alloc] initWithTag:SJEdgeControlLayerBottomItem_LIVEText];
liveItem.hidden = YES;
liveItem.innerHidden = YES;
[self.bottomAdapter addItem:liveItem];

// 当前时间
Expand Down Expand Up @@ -1045,17 +1048,17 @@ - (void)_reloadTopAdapterIfNeeded {
if ( backItem != nil ) {
if ( _fixesBackItem ) {
if ( !isFullscreen && _hiddenBackButtonWhenOrientationIsPortrait )
backItem.hidden = YES;
backItem.innerHidden = YES;
else
backItem.hidden = NO;
backItem.innerHidden = NO;
}
else {
if ( isFullscreen || isFitOnScreen )
backItem.hidden = NO;
backItem.innerHidden = NO;
else if ( _hiddenBackButtonWhenOrientationIsPortrait )
backItem.hidden = YES;
backItem.innerHidden = YES;
else
backItem.hidden = isPlayOnScrollView;
backItem.innerHidden = isPlayOnScrollView;
}

if ( backItem.hidden == NO ) {
Expand All @@ -1074,15 +1077,15 @@ - (void)_reloadTopAdapterIfNeeded {
SJEdgeControlButtonItem *titleItem = [self.topAdapter itemForTag:SJEdgeControlLayerTopItem_Title];
if ( titleItem != nil ) {
if ( self.isHiddenTitleItemWhenOrientationIsPortrait && isSmallscreen ) {
titleItem.hidden = YES;
titleItem.innerHidden = YES;
}
else {
if ( titleItem.customView != self.titleView )
titleItem.customView = self.titleView;
SJVideoPlayerURLAsset *asset = _videoPlayer.URLAsset.original ?: _videoPlayer.URLAsset;
NSAttributedString *_Nullable attributedTitle = asset.attributedTitle;
self.titleView.attributedText = attributedTitle;
titleItem.hidden = (attributedTitle.length == 0);
titleItem.innerHidden = (attributedTitle.length == 0);
}

if ( titleItem.hidden == NO ) {
Expand Down Expand Up @@ -1122,7 +1125,7 @@ - (void)_reloadLeftAdapterIfNeeded {

SJEdgeControlButtonItem *lockItem = [self.leftAdapter itemForTag:SJEdgeControlLayerLeftItem_Lock];
if ( lockItem != nil ) {
lockItem.hidden = !showsLockItem;
lockItem.innerHidden = !showsLockItem;
if ( showsLockItem ) {
id<SJVideoPlayerControlLayerResources> sources = SJVideoPlayerConfigurations.shared.resources;
lockItem.image = isLockedScreen ? sources.lockImage : sources.unlockImage;
Expand Down Expand Up @@ -1205,7 +1208,7 @@ - (void)_reloadCenterAdapterIfNeeded {

SJEdgeControlButtonItem *replayItem = [self.centerAdapter itemForTag:SJEdgeControlLayerCenterItem_Replay];
if ( replayItem != nil ) {
replayItem.hidden = !_videoPlayer.isPlaybackFinished;
replayItem.innerHidden = !_videoPlayer.isPlaybackFinished;
if ( replayItem.hidden == NO && replayItem.title == nil ) {
id<SJVideoPlayerControlLayerResources> resources = SJVideoPlayerConfigurations.shared.resources;
id<SJVideoPlayerLocalizedStrings> strings = SJVideoPlayerConfigurations.shared.localizedStrings;
Expand Down Expand Up @@ -1271,10 +1274,12 @@ - (void)_reloadSizeForBottomTimeLabel {
- (void)_updateContentForBottomProgressSliderItemIfNeeded {
if ( !sj_view_isDisappeared(_bottomContainerView) ) {
SJEdgeControlButtonItem *progressItem = [_bottomAdapter itemForTag:SJEdgeControlLayerBottomItem_Progress];
SJProgressSlider *slider = progressItem.customView;
slider.maxValue = _videoPlayer.duration ? : 1;
if ( !slider.isDragging ) slider.value = _videoPlayer.currentTime;
slider.bufferProgress = _videoPlayer.playableDuration / slider.maxValue;
if ( progressItem != nil && !progressItem.isHidden ) {
SJProgressSlider *slider = progressItem.customView;
slider.maxValue = _videoPlayer.duration ? : 1;
if ( !slider.isDragging ) slider.value = _videoPlayer.currentTime;
slider.bufferProgress = _videoPlayer.playableDuration / slider.maxValue;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#import "Masonry.h"
#endif

#import "SJEdgeControlButtonItemInternal.h"

NS_ASSUME_NONNULL_BEGIN
SJEdgeControlButtonItemTag const SJNotReachableControlLayerTopItem_Back = 10000;

Expand Down Expand Up @@ -125,12 +127,12 @@ - (void)_updateItems:(__kindof SJBaseVideoPlayer *)videoPlayer {

if ( backItem ) {
if ( isFull || isFitOnScreen )
backItem.hidden = NO;
backItem.innerHidden = NO;
else {
if ( _hiddenBackButtonWhenOrientationIsPortrait )
backItem.hidden = YES;
backItem.innerHidden = YES;
else
backItem.hidden = videoPlayer.isPlayOnScrollView;
backItem.innerHidden = videoPlayer.isPlayOnScrollView;
}
}
[_topAdapter reload];
Expand Down
6 changes: 4 additions & 2 deletions SJVideoPlayer/SJVideoPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#import "SJAttributesFactory.h"
#endif

#import "SJEdgeControlButtonItemInternal.h"

NS_ASSUME_NONNULL_BEGIN
#define SJEdgeControlLayerShowsMoreItemNotification @"SJEdgeControlLayerShowsMoreItemNotification"
#define SJEdgeControlLayerIsEnabledClipsNotification @"SJEdgeControlLayerIsEnabledClipsNotification"
Expand Down Expand Up @@ -549,7 +551,7 @@ - (void)_updateAppearStateForMoteItemIfNeeded {
else isHidden = !(self.isFullscreen && !self.rotationManager.isRotating);

if ( isHidden != self.moreItem.isHidden ) {
self.moreItem.hidden = isHidden;
self.moreItem.innerHidden = isHidden;
[self.defaultEdgeControlLayer.topAdapter reload];
}
}
Expand Down Expand Up @@ -588,7 +590,7 @@ - (void)_updateAppearStateForClipsItemIfNeeded {
}
BOOL isHidden = (self.URLAsset == nil) || !self.isFullscreen || isUnsupportedFormat || isPictureInPictureEnabled;
if ( isHidden != _clipsItem.isHidden ) {
_clipsItem.hidden = isHidden;
_clipsItem.innerHidden = isHidden;
[_defaultEdgeControlLayer.rightAdapter reload];
}
}
Expand Down

0 comments on commit 7523d5a

Please sign in to comment.