TXLivePlayer.h
4.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
//
// TXLivePlayer.h
// LiteAV
//
// Created by alderzhang on 2017/5/24.
// Copyright © 2017年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "TXLivePlayListener.h"
#import "TXLivePlayConfig.h"
#import "TXVideoCustomProcessDelegate.h"
#import "TXLiveRecordTypeDef.h"
#import "TXLiveRecordListener.h"
typedef NS_ENUM(NSInteger, TX_Enum_PlayType) {
PLAY_TYPE_LIVE_RTMP = 0, //RTMP直播
PLAY_TYPE_LIVE_FLV, //FLV直播
PLAY_TYPE_VOD_FLV, //FLV点播
PLAY_TYPE_VOD_HLS, //HLS点播
PLAY_TYPE_VOD_MP4, //MP4点播
PLAY_TYPE_LIVE_RTMP_ACC, //RTMP直播加速播放
PLAY_TYPE_LOCAL_VIDEO, //本地视频文件
};
@interface TXLivePlayer : NSObject
@property(nonatomic, weak) id <TXLivePlayListener> delegate;
@property(nonatomic, weak) id <TXVideoCustomProcessDelegate> videoProcessDelegate;
@property(nonatomic, assign) BOOL enableHWAcceleration;
@property(nonatomic, copy) TXLivePlayConfig *config;
//短视频录制
@property (nonatomic, weak) id<TXLiveRecordListener> recordDelegate;
//短视频录制
//@property (nonatomic, weak) id<TXVideoRecordListener> recordDelegate;
@property BOOL isAutoPlay; /// startPlay后是否立即播放,默认YES。点播有效
/* setupVideoWidget 创建Video渲染Widget,该控件承载着视频内容的展示。
* 参数:
* frame : Widget在父view中的rc
* view : 父view
* idx : Widget在父view上的层级位置
* 变更历史:1.5.2版本将参数frame废弃,设置此参数无效,控件大小与参数view的大小保持一致,如需修改控件的大小及位置,请调整父view的大小及位置
* 参考文档:https://www.qcloud.com/doc/api/258/4736#step-3.3A-.E7.BB.91.E5.AE.9A.E6.B8.B2.E6.9F.93.E7.95.8C.E9.9D.A2
*/
- (void)setupVideoWidget:(CGRect)frame containView:(UIView *)view insertIndex:(unsigned int)idx;
/* 修改VideoWidget frame
* 变更历史:1.5.2版本将此方法废弃,调用此方法无效,如需修改控件的大小及位置,请调整父view的大小及位置
* 参考文档:https://www.qcloud.com/doc/api/258/4736#step-3.3A-.E7.BB.91.E5.AE.9A.E6.B8.B2.E6.9F.93.E7.95.8C.E9.9D.A2
*/
//- (void)resetVideoWidgetFrame:(CGRect)frame;
/* removeVideoWidget 移除Video渲染Widget
*/
- (void)removeVideoWidget;
/* startPlay 启动从指定URL播放RTMP音视频流
* 参数:
* url : 完整的URL(如果播放的是本地视频文件,这里传本地视频文件的完整路径)
* playType: 播放类型
* 返回: 0 = OK
*/
- (int)startPlay:(NSString *)url type:(TX_Enum_PlayType)playType;
/* stopPlay 停止播放音视频流
* 返回: 0 = OK
*/
- (int)stopPlay;
/* isPlaying 是否正在播放
* 返回: YES 拉流中,NO 没有拉流
*/
- (bool)isPlaying;
/* pause 暂停播放,适用于点播,直播(此接口会暂停数据拉流,不会销毁播放器,暂停后,播放器会显示最后一帧数据图像)
*
*/
- (void)pause;
/* resume 继续播放,适用于点播,直播
*
*/
- (void)resume;
/*
seek 播放跳转到音视频流某个时间
* time: 流时间,单位为秒
* 返回: 0 = OK
*/
- (int)seek:(float)time;
/*
* setRenderRotation 设置画面的方向
* 参数:
* rotation : 详见 TX_Enum_Type_HomeOrientation 的定义.
*/
- (void)setRenderRotation:(int)rotation;
/* setRenderMode 设置画面的裁剪模式
* 参数
* renderMode : 详见 TX_Enum_Type_RenderMode 的定义。
*/
- (void)setRenderMode:(int)renderMode;
/**
* 设置静音
*/
- (void)setMute:(BOOL)bEnable;
/*视频录制*/
/*
* 开始录制短视频
* 参 数:
* recordType 参见TXRecordType定义
* 返回值:
* 0 成功;
* -1 正在录制短视频;
* -2 videoRecorder初始化失败;
*/
-(int) startRecord:(TXRecordType)recordType;
/*
* 结束录制短视频
* 返回值:
* 0 成功;
* -1 不存在录制任务;
* -2 videoRecorder未初始化;
*/
-(int) stopRecord;
/*
* 截屏
* 参 数:
* snapshotCompletionBlock 通过回调返回当前图像
* 返回值:
*/
- (void)snapshot:(void (^)(UIImage *))snapshotCompletionBlock;
/**
* 设置播放速率。点播有效
*
* 参 数:
* rate 正常速度为1.0
*/
- (void)setRate:(float)rate;
@end