Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] update version to relesse-12.0.0.6067 #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MLVB-API-Example-OC/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Advanced/ThirdBeauty/FaceUnity
Advanced/ThirdBeauty/FaceUnity-SDK-iOS-v7.4.0
Advanced/ThirdBeauty/FaceUnity-SDK-iOS-v7.4.0
.DS_Store
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@
// Copyright © 2021 Tencent. All rights reserved.
//

/*
自定义视频采集
MLVB APP 自定义视频采集功能
本文件展示如何集成自定义视频采集功能
1、打开扬声器 API:[self.livePusher startMicrophone];
2、开启自定义采集 API: [self.livePusher enableCustomVideoCapture:true];
3、开始推流 API:[self.livePusher startPush:[LiveUrl generateTRTCPushUrl:streamId]];
4、发送数据 API: [self.livePusher sendCustomVideoFrame:videoFrame];
参考文档:https://cloud.tencent.com/document/product/454/56601
*/
/*
Custom Video Capturing
Custom Video Capturing in MLVB App
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
// Copyright © 2022 Tencent. All rights reserved.
/*
HLS自适应码率播放
MLVB APP 快直播自适应码率播放功能
本文件展示如何集成快直播自适应码率播放功能
1、设置渲染画面 API:[self.livePlayer setRenderView:self.view];
2、开始播放 API: [self.livePlayer startLivePlay:url];
参考文档:https://cloud.tencent.com/document/product/454/81211
*/
/*
HLS Auto Bitrate
MLVB APP HLS Auto Bitrate
1、Set Render View API:[self.livePlayer setRenderView:self.view];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
// Copyright © 2022 Tencent. All rights reserved.
/*
快直播自适应码率播放
MLVB APP 快直播自适应码率播放功能
本文件展示如何集成快直播自适应码率播放功能
1、设置渲染画面 API:[self.livePlayer setRenderView:self.view];
2、开始播放 API: [self.livePlayer startLivePlay:url];
参考文档:https://cloud.tencent.com/document/product/454/81212
开始自适应码率播放后,就无法进行进行无缝切流了。如果在播放状态进入自适应码率,
需要先停止当前播放,然后再开始自适应播放
*/
/*
Webrtc Auto Bitrate
MLVB APP Webrtc Auto Bitrate
1、Set Render View API:[self.livePlayer setRenderView:self.view];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// NewTimeShiftSpriteViewController.h
// MLVB-API-Example-OC
//
// Created by carol on 2024/04/22.
// Copyright © 2024 Tencent. All rights reserved.
//

#import "ViewController.h"

NS_ASSUME_NONNULL_BEGIN

@interface NewTimeShiftSpriteViewController : ViewController

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
//
// NewTimeShiftSpriteViewController.m
// MLVB-API-Example-OC
//
// Created by carol on 2024/04/22.
// Copyright © 2024 Tencent. All rights reserved.
//

#import "NewTimeShiftSpriteViewController.h"
#import "TXSpriteImageFetcher.h"

static NSString *const G_NEW_TIME_SHIFT_DOMAIN = @"5000.liveplay.myqcloud.com";
static NSString *const G_NEW_TIME_SHIFT_PATH = @"live";
static NSString *const G_NEW_TIME_SHIFT_STREAMID = @"5000_testsprite";

@interface NewTimeShiftSpriteViewController () <UITextFieldDelegate, TXSpriteImageFetcherDelegate>

@property(weak, nonatomic) IBOutlet UITextField *playDomain;
@property(weak, nonatomic) IBOutlet UITextField *playPath;
@property(weak, nonatomic) IBOutlet UITextField *streamId;
@property(weak, nonatomic) IBOutlet UIDatePicker *startTimePick;
@property(weak, nonatomic) IBOutlet UIDatePicker *endTimePick;
@property(weak, nonatomic) IBOutlet UITextField *playOffsetHh;
@property(weak, nonatomic) IBOutlet UITextField *playOffsetMm;
@property(weak, nonatomic) IBOutlet UITextField *playOffsetSs;
@property(weak, nonatomic) IBOutlet UIButton *btnShowSprite;
@property(weak, nonatomic) IBOutlet UIImageView *spriteImage;

@property(nonatomic, strong) TXSpriteImageFetcher *spriteImageFetcher;

@end

@implementation NewTimeShiftSpriteViewController

- (void)viewDidLoad {
[super viewDidLoad];
self.title = localize(@"MLVB-API-Example.Home.NewTimeShiftSprite");
self.view.backgroundColor = UIColor.blackColor;
[self initView];
[self addKeyboardObserver];
}

- (void)initView {
self.playDomain.text = G_NEW_TIME_SHIFT_DOMAIN;
self.playPath.text = G_NEW_TIME_SHIFT_PATH;
self.streamId.text = G_NEW_TIME_SHIFT_STREAMID;
NSDate *currentDate = [NSDate date];
NSDate *oneHourLater = [currentDate dateByAddingTimeInterval:3600]; // 3600秒表示一小时
[self.startTimePick setDate:currentDate];
[self.endTimePick setDate:oneHourLater];
}

- (void)dealloc {
[self removeKeyboardObserver];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.view endEditing:true];
}

- (IBAction)onBtnShowSpriteClick:(id)sender {
[self.spriteImage setImage:nil];
if (self.spriteImageFetcher == nil) {
self.spriteImageFetcher = [[TXSpriteImageFetcher alloc] init];
[self.spriteImageFetcher setDelegate:self];
[self.spriteImageFetcher setCacheSize:10];
[self.spriteImageFetcher init:self.playDomain.text
path:self.playPath.text
streamId:self.streamId.text
startTs:(long)[self.startTimePick.date timeIntervalSince1970]
endTs:(long)[self.endTimePick.date timeIntervalSince1970]];
}
long time = 3600 * [self.playOffsetHh.text intValue] + 60 * [self.playOffsetMm.text intValue] +
[self.playOffsetSs.text intValue];
[self.spriteImageFetcher getThumbnail:time];
}

#pragma mark - TXSpriteImageFetcherDelegate
- (void)onFetchDone:(SpriteThumbnailFetchErrCode)errCode image:(UIImage *)image {
if (errCode != SPRITE_THUMBNAIL_FETCH_SUCC) {
NSString *msg = [NSString stringWithFormat:@"onFetchDone errCode is %ld", (long)errCode];
UIAlertController *alert =
[UIAlertController alertControllerWithTitle:@"提示"
message:msg
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"确定"
style:UIAlertActionStyleDefault
handler:nil]];
// 弹出提示框
[self presentViewController:alert animated:YES completion:nil];
} else {
[self.spriteImage setImage:image];
}
}

#pragma mark - UITextFieldDelegate

- (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string {
return YES;
}

#pragma mark - Notification

- (void)addKeyboardObserver {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
}

- (void)removeKeyboardObserver {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIKeyboardWillHideNotification
object:nil];
}

- (BOOL)keyboardWillShow:(NSNotification *)noti {
return YES;
}

- (BOOL)keyboardWillHide:(NSNotification *)noti {
return YES;
}

@end
Loading