Skip to content

Commit

Permalink
优化首播体验
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiruiou committed Apr 11, 2022
1 parent c32dd57 commit 23ffb31
Show file tree
Hide file tree
Showing 20 changed files with 230 additions and 130 deletions.
1 change: 1 addition & 0 deletions Demo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def common_pods_all
pod 'AFNetworking'
pod 'BlocksKit', '~> 2.2.5'
pod 'CWStatusBarNotification', '~> 2.3.5'
pod 'TXLiteAVSDK_Player'
end

def common_pods_smart
Expand Down
54 changes: 29 additions & 25 deletions Demo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
PODS:
- AFNetworking (4.0.0):
- AFNetworking/NSURLSession (= 4.0.0)
- AFNetworking/Reachability (= 4.0.0)
- AFNetworking/Security (= 4.0.0)
- AFNetworking/Serialization (= 4.0.0)
- AFNetworking/UIKit (= 4.0.0)
- AFNetworking/NSURLSession (4.0.0):
- AFNetworking (4.0.1):
- AFNetworking/NSURLSession (= 4.0.1)
- AFNetworking/Reachability (= 4.0.1)
- AFNetworking/Security (= 4.0.1)
- AFNetworking/Serialization (= 4.0.1)
- AFNetworking/UIKit (= 4.0.1)
- AFNetworking/NSURLSession (4.0.1):
- AFNetworking/Reachability
- AFNetworking/Security
- AFNetworking/Serialization
- AFNetworking/Reachability (4.0.0)
- AFNetworking/Security (4.0.0)
- AFNetworking/Serialization (4.0.0)
- AFNetworking/UIKit (4.0.0):
- AFNetworking/Reachability (4.0.1)
- AFNetworking/Security (4.0.1)
- AFNetworking/Serialization (4.0.1)
- AFNetworking/UIKit (4.0.1):
- AFNetworking/NSURLSession
- BlocksKit (2.2.5):
- BlocksKit/All (= 2.2.5)
Expand All @@ -29,19 +29,20 @@ PODS:
- BlocksKit/UIKit (2.2.5):
- BlocksKit/Core
- BlocksKit/DynamicDelegate
- Bugly (2.5.2)
- Bugly (2.5.91)
- CWStatusBarNotification (2.3.5)
- Masonry (1.1.0)
- MBProgressHUD (1.2.0)
- MJExtension (3.2.1)
- MJRefresh (3.3.1)
- SDWebImage (5.6.1):
- SDWebImage/Core (= 5.6.1)
- SDWebImage/Core (5.6.1)
- MJExtension (3.4.1)
- MJRefresh (3.7.5)
- SDWebImage (5.12.5):
- SDWebImage/Core (= 5.12.5)
- SDWebImage/Core (5.12.5)
- SuperPlayer/Player (3.1.1):
- AFNetworking
- Masonry
- SDWebImage
- TXLiteAVSDK_Player (9.5.29016)

DEPENDENCIES:
- AFNetworking
Expand All @@ -54,6 +55,7 @@ DEPENDENCIES:
- MJRefresh
- SDWebImage
- SuperPlayer/Player (from `./TXLiteAVDemo/SuperPlayerKit/SuperPlayer.podspec`)
- TXLiteAVSDK_Player

SPEC REPOS:
trunk:
Expand All @@ -66,23 +68,25 @@ SPEC REPOS:
- MJExtension
- MJRefresh
- SDWebImage
- TXLiteAVSDK_Player

EXTERNAL SOURCES:
SuperPlayer:
:path: "./TXLiteAVDemo/SuperPlayerKit/SuperPlayer.podspec"

SPEC CHECKSUMS:
AFNetworking: d9fdf484a3c723ec3c558a41cc5754c7e845ee77
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
BlocksKit: 7f422b971407001178d181a43b99014ea2591fe6
Bugly: dbac48b55ad469a97cc4321045cd50df8f63d44f
Bugly: afe841bba2ea6de6d432a3c125240a5e75949c55
CWStatusBarNotification: 3d2738b25c3207f60cc50201388d3c96182545ff
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406
MJExtension: 635f2c663dcb1bf76fa4b715b2570a5710aec545
MJRefresh: eeda70fbf0ad277f3178cef1cd0c3532591d6237
SDWebImage: 7edb9c3ea661e77a66661f7f044de8c1b55d1120
SuperPlayer: 3f49af712410a59c42c2c9bfcacd33e3a0e3e5ab
MJExtension: 21c5f6f8c4d5d8844b7ae8fbae08fed0b501f961
MJRefresh: fdf5e979eb406a0341468932d1dfc8b7f9fce961
SDWebImage: 0905f1b7760fc8ac4198cae0036600d67478751e
SuperPlayer: a0ee257eba416cf238160613186f5f1008acb4c5
TXLiteAVSDK_Player: 5a9cea3ba4e77fc8993b19523afbecdfc1a803ce

PODFILE CHECKSUM: 1df379d334d15387f79476735627426f004b5aed
PODFILE CHECKSUM: df3ee50302b30473bf7bce4ab300599d5f976278

COCOAPODS: 1.10.1
COCOAPODS: 1.11.2
13 changes: 0 additions & 13 deletions Demo/TXLiteAVDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
400923631F4FCC6E009B882D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 40F853221EE8FC7300EE47D7 /* Assets.xcassets */; };
4009238F1F4FCC6E009B882D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 40F853331EE8FC9B00EE47D7 /* Main.storyboard */; };
402A010424506F740037A219 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 402A010024506F740037A219 /* main.m */; };
4071CF5B24441578000B7707 /* TXLiteAVSDK_Player.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4071CF5924441578000B7707 /* TXLiteAVSDK_Player.framework */; };
40A1DEC22638412E0011E532 /* NSData+Common.m in Sources */ = {isa = PBXBuildFile; fileRef = 47E8CAB6260B5C05001CF672 /* NSData+Common.m */; };
40A1DED8263841360011E532 /* NSDictionary+Common.m in Sources */ = {isa = PBXBuildFile; fileRef = 47E8CAC5260B5C05001CF672 /* NSDictionary+Common.m */; };
40A1DEF52638413F0011E532 /* NSObject+CommonBlock.m in Sources */ = {isa = PBXBuildFile; fileRef = 47E8CAB3260B5C05001CF672 /* NSObject+CommonBlock.m */; };
Expand Down Expand Up @@ -176,7 +175,6 @@
402A010724506F9C0037A219 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = App/Info.plist; sourceTree = "<group>"; };
4030B1EC245563B200CF5926 /* SuperPlayer.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = SuperPlayer.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
40407ACA1F3035CA006C7301 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
4071CF5924441578000B7707 /* TXLiteAVSDK_Player.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = TXLiteAVSDK_Player.framework; sourceTree = "<group>"; };
4071CF702444477A000B7707 /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; };
40A49D5E24598CD200BFCB18 /* UGCKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UGCKit.xcodeproj; path = UGCKit/UGCKit.xcodeproj; sourceTree = "<group>"; };
40A7CFED2461102E00E792A5 /* SuperPlayer.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = SuperPlayer.bundle; path = SuperPlayer/Resource/SuperPlayer.bundle; sourceTree = "<group>"; };
Expand Down Expand Up @@ -384,7 +382,6 @@
400922E21F4FCC6E009B882D /* AVFoundation.framework in Frameworks */,
400922E31F4FCC6E009B882D /* MediaPlayer.framework in Frameworks */,
400922E51F4FCC6E009B882D /* libiconv.tbd in Frameworks */,
4071CF5B24441578000B7707 /* TXLiteAVSDK_Player.framework in Frameworks */,
400922E61F4FCC6E009B882D /* libz.tbd in Frameworks */,
400922E71F4FCC6E009B882D /* libc++.tbd in Frameworks */,
400922E91F4FCC6E009B882D /* libresolv.tbd in Frameworks */,
Expand Down Expand Up @@ -510,7 +507,6 @@
40F852FA1EE8FB3800EE47D7 = {
isa = PBXGroup;
children = (
45736E91243F5B2200F7F601 /* SDK */,
40F853051EE8FB3800EE47D7 /* TXLiteAVDemo */,
40F854FF1EE8FD2F00EE47D7 /* Frameworks */,
40F853041EE8FB3800EE47D7 /* Products */,
Expand Down Expand Up @@ -622,15 +618,6 @@
name = Frameworks;
sourceTree = "<group>";
};
45736E91243F5B2200F7F601 /* SDK */ = {
isa = PBXGroup;
children = (
4071CF5924441578000B7707 /* TXLiteAVSDK_Player.framework */,
);
name = SDK;
path = ../SDK;
sourceTree = "<group>";
};
45D8448A23B63C77001CD3A9 /* UGCUpload */ = {
isa = PBXGroup;
children = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
version = "1.7">
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<PreActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "# Type a script or drag a script file from your workspace to insert its path.&#10;cd ${SRCROOT}&#10;&#10;TARGET=&quot;Player&quot;&#10;&#10;if [[ ! -e &quot;../SDK/TXLiteAVSDK_${TARGET}.framework&quot; || ! -e &quot;./Pods&quot; ]]; then&#10; #URL=&quot;$(cat ../SDK/README.md | grep -o &apos;http.*zip&apos;)&quot;&#10; URL=&quot;https://liteav.sdk.qcloud.com/download/latest/TXLiteAVSDK_${TARGET}_iOS_latest.zip&quot;&#10; echo &quot;Downloading SDK from $URL&quot;&#10; curl &quot;$URL&quot; --output ../SDK/TXLiteAVSDK_${TARGET}_iOS.zip&#10; pushd ../SDK&#10; unzip TXLiteAVSDK_${TARGET}_iOS.zip&#10; rm -rf __MACOSX&#10; if [ ! -e &quot;./TXLiteAVSDK_${TARGET}.framework&quot; ]; then&#10; mv LiteAVSDK_${TARGET}_*/SDK/*.framework .&#10; fi&#10; popd&#10; if [ ! -e &quot;./Pods&quot; ]; then&#10; mv ../SDK/LiteAVSDK_${TARGET}_*/Demo/Pods ./&#10; xcodebuild -project ./Pods/Pods.xcodeproj -configuration $(CONFIGURATION)&#10; fi&#10; rm -rf ../SDK/TXLiteAVSDK_${TARGET}_*.zip&#10; rm -rf ../SDK/LiteAVSDK_${TARGET}_iOS_*&#10;fi&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "400922A31F4FCC6E009B882D"
BuildableName = "TXLiteAVDemo_Player.app"
BlueprintName = "TXLiteAVDemo_Player"
ReferencedContainer = "container:TXLiteAVDemo.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ - (void)viewWillAppear:(BOOL)animated {

// 左侧返回按钮
UIButton *leftbutton = [UIButton buttonWithType:UIButtonTypeCustom];
[leftbutton setFrame:CGRectMake(0, 0, 60, 25)];
[leftbutton setFrame:CGRectMake(5, 0, 150, 35)];
[leftbutton setBackgroundImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
[leftbutton addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
[leftbutton sizeToFit];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ - (void)playVideoWithModel:(FeedVideoModel *)model {
playerModel.duration = model.duration;

[self.superPlayView playWithModel:playerModel];

SPDefaultControlView *dv = (SPDefaultControlView *)self.superPlayView.controlView;
dv.disableDanmakuBtn = YES;
}

- (void)pause {
Expand Down
9 changes: 9 additions & 0 deletions Demo/TXLiteAVDemo/SuperPlayFeedDemo/Views/FeedDetailView.m
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
[self.temPlayView playWithModel:[self setSuperPlayerModel:cell.model]];
[self.temPlayView.controlView setTitle:cell.model.title];
[self.temPlayView showOrHideBackBtn:NO];

// 修改介绍
FeedHeadModel *model = [[FeedHeadModel alloc] init];
model.headImageUrl = cell.model.coverUrl;
model.videoNameStr = cell.model.title;
model.videoSubTitleStr = cell.model.videoIntroduce;
model.videoDesStr = cell.model.videoDesStr;
[self setModel:model];

}
}

Expand Down
7 changes: 7 additions & 0 deletions Demo/TXLiteAVDemo/SuperPlayFeedDemo/Views/SuperFeedPlayView.m
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,19 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N

// 松手时已经静止,只会调用scrollViewDidEndDragging
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
if (self.tableView.mj_header.isRefreshing) {
return;
}

if (!decelerate) {
[self handleScroll];
}
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
if (self.tableView.mj_header.isRefreshing) {
return;
}
[self handleScroll];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ - (void)updateLockScreenInfo {
NSMutableDictionary *playingInfoDict = [NSMutableDictionary dictionary];

// 2、设置名称
[playingInfoDict setObject:[NSString stringWithFormat:@"歌曲1"]
forKey:MPMediaItemPropertyTitle];
[playingInfoDict setObject:[NSString stringWithFormat:@"专辑1"]
forKey:MPMediaItemPropertyAlbumTitle];
[playingInfoDict setObject:self.playerView.playerModel.name forKey:MPMediaItemPropertyTitle];


// 3、设置封面的图片
Expand Down Expand Up @@ -255,8 +252,6 @@ - (void)viewDidLoad {
[self.playerView.controlView setTitle:LivePlayerLocalize(@"SuperPlayerDemo.MoviePlayer.uploadvideo")];
}

self.playerFatherView = [[UIView alloc] init];
self.playerFatherView.backgroundColor = [UIColor blackColor];
[self.view addSubview:self.playerFatherView];
[self.playerFatherView mas_makeConstraints:^(MASConstraintMaker *make) {
if (@available(iOS 11.0, *)) {
Expand Down Expand Up @@ -544,6 +539,14 @@ - (SuperPlayerView *)playerView {
return _playerView;
}

- (UIView *)playerFatherView {
if (!_playerFatherView) {
_playerFatherView = [[UIView alloc] init];
_playerFatherView.backgroundColor = [UIColor blackColor];
}
return _playerFatherView;
}

- (void)onNetSuccess:(NSArray *)videoArray {
NSArray *modelArray = [self getVideoModelWithVideoArray:videoArray];
[_vodDataSourceArray addObject:modelArray];
Expand Down Expand Up @@ -837,6 +840,7 @@ - (void)onScanResult:(NSString *)result {
} else {
model.videoURL = result;
}
model.name = [NSString stringWithFormat:@"%@%lu", LivePlayerLocalize(@"SuperPlayerDemo.MoviePlayer.video"), (unsigned long)_vodDataSourceArray.count + 1];
[self playModel:model];

ListVideoModel *m = [ListVideoModel new];
Expand Down
20 changes: 0 additions & 20 deletions Demo/TXLiteAVDemo/SuperPlayerKit/SuperPlayer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,47 +34,27 @@ Pod::Spec.new do |spec|
#如果要使用cocopods管理的TXLiteAVSDK_Player,就不注释这一行
# s.dependency 'TXLiteAVSDK_Player', '= 5.3.6001'
#如果要使用最新的TXLiteAVSDK_Player,就不注释这一行
framework_path="../../../SDK/TXLiteAVSDK_Player.framework"
s.pod_target_xcconfig={
'HEADER_SEARCH_PATHS'=>["$(PODS_TARGET_SRCROOT)/#{framework_path}/Headers"]
}
end
spec.subspec "Professional" do |s|
s.source_files = 'SuperPlayer/**/*.{h,m}'
s.private_header_files = 'SuperPlayer/Utils/TXBitrateItemHelper.h', 'SuperPlayer/Views/SuperPlayerView+Private.h'
# s.resource = 'SuperPlayer/Resource/*'
framework_path="../../../SDK/TXLiteAVSDK_Professional.framework"
s.pod_target_xcconfig={
'HEADER_SEARCH_PATHS'=>["$(PODS_TARGET_SRCROOT)/#{framework_path}/Headers"]
}
end
spec.subspec "Enterprise" do |s|
s.source_files = 'SuperPlayer/**/*.{h,m}'
s.private_header_files = 'SuperPlayer/Utils/TXBitrateItemHelper.h', 'SuperPlayer/Views/SuperPlayerView+Private.h'
# s.resource = 'SuperPlayer/Resource/*'
framework_path="../../../SDK/TXLiteAVSDK_Enterprise.framework"
s.pod_target_xcconfig={
'HEADER_SEARCH_PATHS'=>["$(PODS_TARGET_SRCROOT)/#{framework_path}/Headers"]
}
end
spec.subspec "Smart" do |s|
s.source_files = 'SuperPlayer/**/*.{h,m}'
s.private_header_files = 'SuperPlayer/Utils/TXBitrateItemHelper.h', 'SuperPlayer/Views/SuperPlayerView+Private.h'
# s.resource = 'SuperPlayer/Resource/*'
framework_path="../../../SDK/TXLiteAVSDK_Smart.framework"
s.pod_target_xcconfig={
'HEADER_SEARCH_PATHS'=>["$(PODS_TARGET_SRCROOT)/#{framework_path}/Headers"]
}
end
spec.subspec "UGC" do |s|
s.source_files = 'SuperPlayer/**/*.{h,m}'
s.private_header_files = 'SuperPlayer/Utils/TXBitrateItemHelper.h', 'SuperPlayer/Views/SuperPlayerView+Private.h'
# s.resource = 'SuperPlayer/Resource/*'
# framework_path="Frameworks/TXLiteAVSDK_UGC.framework"
framework_path="../../../SDK/TXLiteAVSDK_UGC.framework"
s.pod_target_xcconfig={
'HEADER_SEARCH_PATHS'=>["$(PODS_TARGET_SRCROOT)/#{framework_path}/Headers"]
}
end
# spec.subspec "UGC_PITU" do |s|
# s.dependency 'SuperPlayer/Core'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ - (void)resolutionBtnClick:(UIButton *)sender {
self.resolutionView.hidden = NO;
[DataReport report:@"change_resolution" param:nil];

[self cancelFadeOut];
[self fadeShow];
self.isShowSecondView = YES;
}

Expand Down
33 changes: 33 additions & 0 deletions Demo/TXLiteAVDemo/SuperPlayerKit/SuperPlayer/SuperPlayerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,36 @@
@class TXVipTipView;
@class TXVipWatchView;
@class TXVipWatchModel;
@class TXLivePlayer;
@class TXVodPlayer;

@protocol SuperPlayerPlayListener <NSObject>
@optional

/// 直播事件通知
/// @param player 直播播放器
/// @param evtID 参见 TXLiveSDKEventDef.h
/// @param param 参见 TXLiveSDKTypeDef.h
- (void)onLivePlayEvent:(TXLivePlayer *)player event:(int)evtID withParam:(NSDictionary *)param;

/// 直播网络状态通知
/// @param player 直播播放器
/// @param param 参见 TXLiveSDKTypeDef.h
- (void)onLiveNetStatus:(TXLivePlayer *)player withParam:(NSDictionary *)param;

/// 点播事件通知
/// @param player 点播播放器
/// @param evtID 参见TXLiveSDKTypeDef.h
/// @param param 参见TXLiveSDKTypeDef.h
- (void)onVodPlayEvent:(TXVodPlayer *)player event:(int)evtID withParam:(NSDictionary *)param;

/// 点播网络状态通知
/// @param player 点播播放器
/// @param param 参见TXLiveSDKTypeDef.h
- (void)onVodNetStatus:(TXVodPlayer *)player withParam:(NSDictionary *)param;

@end

@protocol SuperPlayerDelegate <NSObject>
@optional
/// 返回事件
Expand All @@ -34,6 +64,7 @@ typedef NS_ENUM(NSInteger, SuperPlayerState) {
StatePlaying, // 播放中
StateStopped, // 停止播放
StatePause, // 暂停播放
StateFirstFrame, // 第一帧画面
};

/// 播放器布局样式
Expand All @@ -47,6 +78,8 @@ typedef NS_ENUM(NSInteger, SuperPlayerLayoutStyle) {
/** 设置代理 */
@property(nonatomic, weak) id<SuperPlayerDelegate> delegate;

@property(nonatomic, weak) id<SuperPlayerPlayListener> playListener;

@property(nonatomic, assign) SuperPlayerLayoutStyle layoutStyle;

/// 设置播放器的父view。播放过程中调用可实现播放窗口转移
Expand Down
Loading

0 comments on commit 23ffb31

Please sign in to comment.