Skip to content

Commit

Permalink
feature: feed video support preoload strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzy-volc committed Mar 3, 2023
1 parent 10ef6c3 commit 2f7d868
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VOLCDemo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ platform :ios, '9.0'

target 'VOLCDemo' do
# vod SDK
pod 'TTSDK', '1.35.1.3-premium', :subspecs => ['Player']
pod 'TTSDK', '1.36.1.2-premium', :subspecs => ['Player']
# vod all scene exhibition
pod 'VEPlayModule', :path=> './VEPlayModule/'
# vod player kit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#import "VEVideoModel.h"
#import "VEDataManager.h"
#import "VEVideoPlayerController.h"
#import "VEVideoPlayerController+Strategy.h"
#import "VEFeedVideoDetailViewController.h"
#import "VESettingManager.h"
#import <Masonry/Masonry.h>

static NSString *VEFeedVideoNormalCellReuseID = @"VEFeedVideoNormalCellReuseID";
Expand All @@ -31,6 +33,7 @@ @implementation VEFeedVideoViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initialUI];
[self startVideoStategy];
[self loadData];
}

Expand All @@ -44,6 +47,13 @@ - (void)dealloc {
self.playerController = nil;
}

- (void)startVideoStategy {
VESettingModel *preload = [[VESettingManager universalManager] settingForKey:VESettingKeyShortVideoPreloadStrategy];
if (preload.open) {
[VEVideoPlayerController enableEngineStrategy:TTVideoEngineStrategyTypePreload scene:TTVEngineStrategySceneShortVideo];
}
}

#pragma mark ----- Base

- (void)initialUI {
Expand Down Expand Up @@ -142,6 +152,13 @@ - (void)loadData {
[self.videoModels removeAllObjects];
[VEDataManager dataForScene:VESceneTypeFeedVideo range:NSMakeRange(0, 0) result:^(NSArray<VEVideoModel *> *videoModels) {
dispatch_async(dispatch_get_main_queue(), ^{
// trans video model to strategy source
NSMutableArray *sources = [NSMutableArray array];
[videoModels enumerateObjectsUsingBlock:^(VEVideoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
[sources addObject:[VEVideoModel videoEngineVidSource:obj]];
}];
[VEVideoPlayerController setStrategyVideoSources:sources];

[self.videoModels addObjectsFromArray:videoModels];
[self.tableView reloadData];
});
Expand Down
2 changes: 1 addition & 1 deletion VOLCDemo/VEPlayerKit/VEPlayerKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Pod::Spec.new do |s|
s.source_files = 'Classes/*'
s.public_header_files = 'Classes/*.{h}'

s.dependency 'TTSDK/Player', '1.35.1.3-premium'
s.dependency 'TTSDK/Player', '1.36.1.2-premium'
s.dependency 'Masonry'
s.dependency 'SDWebImage'

Expand Down

0 comments on commit 2f7d868

Please sign in to comment.