Skip to content

Commit

Permalink
Merge pull request #2 from Kivenhaoyu/v1.0.0-release
Browse files Browse the repository at this point in the history
support Cocoapods
  • Loading branch information
Kivenhaoyu authored Jan 25, 2021
2 parents dcacecf + 4578d47 commit 4eb44dc
Show file tree
Hide file tree
Showing 26 changed files with 1,199 additions and 99 deletions.
217 changes: 217 additions & 0 deletions Pod/universal/QNRTPlayerKit.framework/Headers/QNRTPlayer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
//
// QNRTPlayer.h
// QNRTPlayerKit
//
// Created by 何云旗 on 2020/12/23.
//

#import <Foundation/Foundation.h>
#import "QNRTTypeDefines.h"

@class QNRTPlayer;
@class QNRTVideoView;

NS_ASSUME_NONNULL_BEGIN

/*!
* @protocol QNRTPlayerDelegate
*
* @discussion QNRTPlayer 在运行过程中的状态和事件回调。
*
* @since v1.0.0
*/
@protocol QNRTPlayerDelegate <NSObject>

@optional
/*!
* @abstract SDK 运行过程中发生错误会通过该方法回调。
*
* @discussion 具体错误码的含义可以见 QNRTTypeDefines.h 文件。
*
* @since v1.0.0
*/
- (void)RTPlayer:(QNRTPlayer *)player didFailWithError:(NSError *)error;

/**
* QNRTPlayer 在运行过程中,状态发生变化的回调
*
* @param player QNRTPlayer
* @param playState 播放状态
* @discussion QNRTPlayStateError 不会通过此回调,会通过 - (void)RTPlayer:(QNRTPlayer *)player didFailWithError:(NSError *)error;回调出来。
*
* @since v1.0.0
*/
- (void)RTPlayer:(QNRTPlayer *)player playStateDidChange:(QNRTPlayState)playState;

/*!
* @abstract 统计信息回调。
*
* @discussion 回调的时间间隔由 statisticInterval 参数决定,statisticInterval 默认为 0,即不回调统计信息。
*
* @see statisticInterval
*
* @since v1.0.0
*/
- (void)RTPlayer:(QNRTPlayer *)player didGetStatistic:(NSDictionary *)statistic;

/*!
* @abstract 当前流媒体流收到音频轨道。
*
* @since v1.0.0
*/
- (void)RTPlayer:(QNRTPlayer *)player trackDidReceived:(QNRTSourceKind )kind;

/*!
* @abstract 音视频首帧解码后的回调。
*
* @since v1.0.0
*/
- (void)RTPlayer:(QNRTPlayer *)player firstSourceDidDecode:(QNRTSourceKind )kind;

@end

@interface QNRTPlayer : NSObject

/*!
* @abstract 状态回调的 delegate。
*
* @since v1.0.0
*/
@property (nonatomic, weak) id<QNRTPlayerDelegate> delegate;

/*!
* @abstract 播放状态
*
* @since v1.0.0
*/
@property (nonatomic, assign, readonly) QNRTPlayState playState;

/*!
* @abstract 是否在播放
*
* @since v1.0.0
*/
@property (nonatomic, assign, readonly) BOOL isPlaying;

/*!
* @abstract 播放 url
*
* @since v1.0.0
*/
@property (nonatomic, copy, readonly) NSURL *playUrl;

/*!
* @abstract 播放音量。
*
* @discussion 范围从 0 ~ 1,默认为 1。
*
* @since v1.0.0
*/
@property (nonatomic, assign) double volume;

/**
* 视频的宽
*
* @since v1.0.0
*/
@property (nonatomic, assign, readonly) CGFloat width;

/**
* 视频的高
*
* @since v1.0.0
*/
@property (nonatomic, assign, readonly) CGFloat height;

/*!
* @abstract 统计信息回调的时间间隔。
*
* @discussion 单位为秒。默认为 0,即默认不会回调统计信息。
*
* @since v1.0.0
*/
@property (nonatomic, assign) NSUInteger statisticInterval;

/*!
* @abstract 渲染播放画面。
*
* @since v1.0.0
*/
@property (nonatomic, strong) QNRTVideoView *playView;

/**
* 开始播放新的 url
*
* @param url 需要播放的 url ,目前支持 webrtc (url 以 webrtc:// 开头) 协议。
* @param isSupport 当前播放 URL 是否支持 SSL 证书,默认为 NO
*
* @since v1.0.0
*/
- (void)playWithUrl:(NSURL *)url supportHttps:(BOOL)isSupport;

/**
* 停止播放器
*
* @since v1.0.0
*/
- (void)stop;

/**
* 静音
*
* @since 1.0.0
*/
- (void)muteAudio:(BOOL)mute;
/**
* 停止画面渲染
*
* @since 1.0.0
*/
- (void)muteVideo:(BOOL)mute;

@end

#pragma mark - Category (Logging)

/*!
* @category QNRTPlayer(Logging)
*
* @discussion 与日志相关的接口。
*
* @since v1.0.0
*/
@interface QNRTPlayer (Logging)

/*!
* @abstract 开启文件日志
*
* @discussion 为了不错过日志,建议在 App 启动时即开启,日志文件位于 App Container/Library/Caches/Pili/RTLogs 目录下以 QNRTPlayer+当前时间命名的目录内
* 注意:文件日志功能主要用于排查问题,打开文件日志功能会对性能有一定影响,上线前请记得关闭文件日志功能!
*
* @since v1.0.0
*/
+ (void)enableFileLogging;

@end

#pragma mark - Category (Info)

/*!
* @category QNRTPlayer(Info)
*
* @discussion SDK 相关信息的接口。
*
* @since v1.0.0
*/
@interface QNRTPlayer (Info)

/*!
* @abstract 获取 SDK 的版本信息。
*
* @since v1.0.0
*/
+ (NSString *)versionInfo;

@end

NS_ASSUME_NONNULL_END
23 changes: 23 additions & 0 deletions Pod/universal/QNRTPlayerKit.framework/Headers/QNRTPlayerKit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// QNRTPlayerKit.h
// QNRTPlayerKit
//
// Created by 何云旗 on 2020/12/23.
//

#import <Foundation/Foundation.h>

//! Project version number for QNRTPlayerKit.
FOUNDATION_EXPORT double QNRTPlayerKitVersionNumber;

//! Project version string for QNRTPlayerKit.
FOUNDATION_EXPORT const unsigned char QNRTPlayerKitVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <QNRTPlayerKit/PublicHeader.h>


#import <QNRTPlayerKit/QNRTTypeDefines.h>
#import <QNRTPlayerKit/QNRTPlayer.h>
#import <QNRTPlayerKit/QNRTVideoRender.h>
#import <QNRTPlayerKit/QNRTVideoView.h>

108 changes: 108 additions & 0 deletions Pod/universal/QNRTPlayerKit.framework/Headers/QNRTTypeDefines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
//
// QNRTTypeDefines.h
// QNRTPlayerKit
//
// Created by 何云旗 on 2020/12/24.
//

#ifndef QNRTPlayerKit_QNRTTypeDefines_h
#define QNRTPlayerKit_QNRTTypeDefines_h

#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

extern NSString *QNRTErrorDomain;

#pragma mark - RTPlayer Error Code

NS_ERROR_ENUM(QNRTErrorDomain)
{
// 服务请求超时,或者域名解析错误等
QNRTErrorNetworkError = 20001,
// 请求服务鉴权失败
QNRTErrorAuthFailed = 20002,
// 播放流地址不存在
QNRTErrorPlayStreamNotExit = 20003,
// 对应服务 invalid parameter / server error
QNRTErrorPlayRequestFailed = 20004,
// 内部sdp错误
QNRTErrorDescriptionError = 20005,
// 连接异常
QNRTErrorConnectFailed = 20006,

};

///音频播放状态
typedef NS_ENUM(NSUInteger, QNRTPlayState) {
/*!
* @abstract 未知状态,只会作为 init 前的初始状态,开始播放之后任何情况下都不会再回到此状态。
*
* @since v1.0.0
*/
QNRTPlayStateUnknow,
/*!
* @abstract 初始状态
*
* @since v1.0.0
*/
QNRTPlayStateInit = 0,
/*!
* @abstract 准备播放的状态
*
* @since v1.0.0
*/
QNRTPlayStateReady,
/*!
* @abstract 正在播放的状态
*
* @since v1.0.0
*/
QNRTPlayStatePlaying,
/*!
* @abstract 停止播放的状态
*
* @since v1.0.0
*/
QNRTPlayStateStoped,
/*!
* @abstract 播放发生错误的状态
*
* @since v1.0.0
*/
QNRTPlayStateError
};

/*!
@typedef QNRTSourceKind
@abstract 定义 Source 的类型。
*/
typedef NS_ENUM(NSUInteger, QNRTSourceKind) {
QNRTSourceKindAudio = 0,
QNRTSourceKindVideo = 1,
};

//视频填充模式
typedef enum {
/**
@brief Stretch to fill the full view, which may distort the image outside of its normal aspect ratio
*/
QNRTVideoFillModeStretch,

/**
@brief Maintains the aspect ratio of the source image, adding bars of the specified background color
*/
QNRTVideoFillModePreserveAspectRatio,

/**
@brief Maintains the aspect ratio of the source image, zooming in on its center to fill the view
*/
QNRTVideoFillModePreserveAspectRatioAndFill
} QNRTVideoFillModeType;


extern NSString *QNRTStatisticAudioBitrateKey;
extern NSString *QNRTStatisticVideoBitrateKey;
extern NSString *QNRTStatisticVideoFrameRateKey;


#endif /* QNRTTypeDefines_h */
25 changes: 25 additions & 0 deletions Pod/universal/QNRTPlayerKit.framework/Headers/QNRTVideoRender.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// QNRTVideoRender.h
// QNRTPlayerKit
//
// Created by 何云旗 on 2020/12/24.
//

#import <Foundation/Foundation.h>
#import "QNRTVideoView.h"

NS_ASSUME_NONNULL_BEGIN

@interface QNRTVideoRender : NSObject

/**
@brief 对应的 sessionId,由 SDK 内部设置
*/
@property (nonatomic, strong, readonly) NSString *sessionId;


@property (nonatomic, strong) QNRTVideoView *renderView;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 4eb44dc

Please sign in to comment.