This commit is contained in:
2024-07-17 14:06:06 +08:00
parent 5c589a22fa
commit 11e9354b54
278 changed files with 331052 additions and 3935 deletions

View File

@@ -0,0 +1,81 @@
//
// AMDDelegate.h
// AliMediaDownloader
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#ifndef AMDDelegate_h
#define AMDDelegate_h
@class AVPMediaInfo;
@class AVPErrorModel;
@class AliMediaDownloader;
#import <Foundation/Foundation.h>
@protocol AMDDelegate <NSObject>
@optional
/**
@brief 下载准备完成事件回调
@param downloader 下载downloader指针
@param info 下载准备完成回调,@see AVPMediaInfo
*/
/****
@brief Download preparation completion callback.
@param downloader Downloader pointer.
@param info Download preparation completion callback. @see AVPMediaInfo
*/
-(void)onPrepared:(AliMediaDownloader*)downloader mediaInfo:(AVPMediaInfo*)info;
/**
@brief 错误代理回调
@param downloader 下载downloader指针
@param errorModel 播放器错误描述参考AliVcPlayerErrorModel
*/
/****
@brief Proxy error callback.
@param downloader Downloader pointer.
@param errorModel Player error description. See AliVcPlayerErrorModel
*/
- (void)onError:(AliMediaDownloader*)downloader errorModel:(AVPErrorModel *)errorModel;
/**
@brief 下载进度回调
@param downloader 下载downloader指针
@param percent 下载进度 0-100
*/
/****
@brief Download progress callback.
@param downloader Downloader pointer.
@param percent Download progress: 0 to 100.
*/
- (void)onDownloadingProgress:(AliMediaDownloader*)downloader percentage:(int)percent;
/**
@brief 下载文件的处理进度回调
@param downloader 下载downloader指针
@param percent 下载进度 0-100
*/
/****
@brief Downloaded file processing progress callback.
@param downloader Downloader pointer.
@param percent Processing progress: 0 to 100.
*/
- (void)onProcessingProgress:(AliMediaDownloader*)downloader percentage:(int)percent;
/**
@brief 下载完成回调
@param downloader 下载downloader指针
*/
/****
@brief Download completion callback.
@param downloader Downloader pointer.
*/
- (void)onCompletion:(AliMediaDownloader*)downloader;
@end
#endif /* AMDDelegate_h */

View File

@@ -0,0 +1,51 @@
//
// AVPCacheConfig.h
// AliPlayerSDK
//
// Created by huang_jiafa on 2019/05/31.
// Copyright (c) 2019 Aliyun. All rights reserved.
//
#ifndef AVPCacheConfig_h
#define AVPCacheConfig_h
#import <Foundation/Foundation.h>
OBJC_EXPORT
@interface AVPCacheConfig : NSObject
/**
@brief 缓存目录
*/
/****
@brief The cache directory.
*/
@property (nonatomic, copy) NSString *path;
/**
@brief 单个视频缓存的最大时长单位秒即某个视频的时长超过maxDuration将不会被缓存
*/
/****
@brief The maximum length of a single video that can be cached. Unit: seconds. Videos that exceed the maximum length are not cached.
*/
@property (nonatomic, assign) long maxDuration;
/**
@brief 所有缓存最大占用空间单位MB
*/
/****
@brief The maximum cache memory size. Unit: MB.
*/
@property (nonatomic, assign) int maxSizeMB;
/**
@brief 是否开启缓存。默认关闭。
*/
/****
@brief Enable or disable content caching. Default: disabled.
*/
@property (nonatomic, assign) BOOL enable;
@end
#endif /* AVPCacheConfig_h */

View File

@@ -0,0 +1,250 @@
//
// AVPConfig.h
// AliPlayerSDK
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#ifndef AVPConfig_h
#define AVPConfig_h
#import <Foundation/Foundation.h>
OBJC_EXPORT
@interface AVPConfig : NSObject
/**
@brief 直播最大延迟 默认5000毫秒单位毫秒
*/
/****
@brief The maximum broadcasting delay. Default: 5000 milliseconds, Unit: millisecond.
*/
@property (nonatomic, assign) int maxDelayTime;
/**
@brief 卡顿后缓存数据的高水位,当播放器缓存数据大于此值时开始播放,单位毫秒
*/
/****
@brief The size of data to be cached before the player can be resumed from playback lag. When the size of the data cached by the player reaches this value, the playback is resumed, Unit: millisecond.
*/
@property (nonatomic, assign) int highBufferDuration;
/**
@brief 开始起播缓存区数据长度默认500ms单位毫秒
*/
/****
@brief The size of the cache data required for starting playback. Default: 500 milliseconds, Unit: millisecond.
*/
@property (nonatomic, assign) int startBufferDuration;
/**
@brief 播放器最大的缓存数据长度默认50秒单位毫秒
*/
/****
@brief The maximum size of cache data. Default: 50 seconds, Unit: millisecond.
*/
@property (nonatomic, assign) int maxBufferDuration;
/**
@brief 网络超时时间默认15秒单位毫秒
*/
/****
@brief Network connection timeout time. Default: 15 seconds, Unit: millisecond.
*/
@property (nonatomic, assign) int networkTimeout;
/**
@brief 网络重试次数每次间隔networkTimeoutnetworkRetryCount=0则表示不重试重试策略app决定默认值为2
*/
/****
@brief The maximum network reconnection attempts. Default: 2. networkTimeout specifies the reconnection interval. networkRetryCount=0 indicates that automatic network reconnection is disabled. The reconnection policy varies depending on the app.
*/
@property (nonatomic, assign) int networkRetryCount;
/**
@brief probe数据大小默认-1,表示不设置
*/
/****
@brief The size of the probe data. Default: -1. Value -1 indicates that the probe data size is not specified. */
@property (nonatomic, assign) int maxProbeSize;
/**
@brief 请求referer
*/
/****
@brief Request Referer.
*/
@property (nonatomic, copy) NSString *referer;
/**
@brief user Agent
*/
/****
@brief UserAgent.
*/
@property (nonatomic, copy) NSString *userAgent;
/**
@brief httpProxy代理
*/
/****
@brief HTTP proxy.
*/
@property (nonatomic, copy) NSString *httpProxy;
/**
@brief 调用stop停止后是否显示最后一帧图像YES代表清除显示黑屏默认为NO
*/
/****
@brief Whether to clear the last frame when the player is stopped. Set to YES to clear the last frame and a black view is displayed. Default: NO.
*/
@property (nonatomic, assign) BOOL clearShowWhenStop;
/**
@brief 添加自定义header
*/
/****
@brief Add a custom header.
*/
@property (nonatomic, copy) NSMutableArray *httpHeaders;
/**
@brief 是否启用SEI
*/
/****
@brief Enable or disable SEI.
*/
@property (nonatomic, assign) BOOL enableSEI;
/**
@brief 当通过GlobalSettings API打开本地缓存功能后此处可设置当前播放器实例是否允许被缓存默认允许。
*/
/****
@brief When local cached is enabled in GlobalSettings API, this config can be used to enable or disable local cache in current player instance, by default is ON.
*/
@property(nonatomic, assign) BOOL enableLocalCache;
/* set the video format for renderFrame callback
* vtb decoder only, equal to OSType, not be supported by other decoder
* support 420v 420f y420 BGRA
* */
@property (nonatomic, assign) int pixelBufferOutputFormat;
/**
@brief HLS直播时起播分片位置。
*/
/****
@brief The start playing index of fragments, when HLS is live.
*/
@property(nonatomic, assign) int liveStartIndex;
/**
@brief 禁用Audio.
*/
/****
@brief Disable audio track.
*/
@property (nonatomic, assign) BOOL disableAudio;
/**
@brief 禁用Video
*/
/****
@brief Disable video track.
*/
@property (nonatomic, assign) BOOL disableVideo;
/**
@brief 进度跟新的频率。包括当前位置和缓冲位置。
*/
/****
@brief Set the frequencies of Progress. Includes the current position and the buffer position.
*/
@property(nonatomic, assign) int positionTimerIntervalMs;
/**
@brief 设置播放器后向buffer的最大值.
*/
/****
@brief set the maximum backward buffer duration of the player.
*/
@property(nonatomic, assign) uint64_t mMAXBackwardDuration;
/**
@brief 优先保证音频播放在网络带宽不足的情况下优先保障音频的播放目前只在dash直播流中有效视频已经切换到了最低码率
*/
/****
@brief prefer audio playback; prefer audio playback when under insufficient network bandwidth. At present, it is only effective in dash live stream (the video has been switched to the lowest bit rate)
*/
@property (nonatomic, assign) BOOL preferAudio;
/**
@brief 播放器实例是否可以使用http dns进行解析-1 表示跟随全局设置0 disable
*/
/****
@brief whether enable http dns, -1 : as globel setting
*/
@property(nonatomic, assign) int enableHttpDns;
/**
@brief 使用http3进行请求支持标准RFC 9114HTTP3和RFC 9000QUIC v1默认值关。如果http3请求失败自动降级至普通http默认关闭
*/
/****
@brief Use http3 to request, supported standards:RFC 9114(HTTP3) and RFC 9000(QUIC v1), false by default. If request failed, it will automatically downgrade to normal http.
*/
@property(nonatomic, assign) BOOL enableHttp3;
/**
@brief 用于纯音频或纯视频的RTMP/FLV直播流起播优化策略当流的header声明只有音频或只有视频时且实际流的内容跟header声明一致时此选项打开可以达到快速起播的效果。默认关闭
*/
/****
@brief Used to fast stream start when playing pure audio or pure video in RTMP/FLV live stream. If live stream header states only audio or only video and the stream content really contains the same single stream, enable this option can fast start the stream. Default value is false.
*/
@property(nonatomic, assign) BOOL enableStrictFlvHeader;
/**
@brief 针对打开了点播URL鉴权的媒体资源HLS协议开启本地缓存后可选择不同的鉴权模式非严格鉴权(false)鉴权也缓存若上一次只缓存了部分媒体下次播放至非缓存部分时播放器会用缓存的鉴权发起请求如果URL鉴权设置的有效很短的话会导致播放异常。严格鉴权(true)鉴权不缓存每次起播都进行鉴权无网络下会导致起播失败。默认值false。
*/
/****
@brief For media that enabled URL authorization(HLS protocol), when local cache is enabled, we can choose different auth mode:Non Strict Mode(false): Auth is cached. If last play cached part of the media, and next play to non-cache part, player will use old auth to request, which may fail if the auth timeout configuration in the server is very short. Strict Mode(true): Auth is not cached. Every play will do the auth verification, so when there is no network, media cannot be played. Default is false.
*/
@property(nonatomic, assign) BOOL enableStrictAuthMode;
/**
* 允许当前播放器实例进行投屏
* 你需要集成投屏SDK来完成投屏功能
* 默认值关
*/
/****
* Enable projection for current player
* You need to integrate projection SDK to do this
* Default is false.
*/
@property(nonatomic, assign) BOOL enableProjection;
/**
@brief 音频打断模式如接电话期间0 表示打断期间暂停播放打断结束恢复播放1 表示打断期间依然持续播放。默认值0
*/
/****
@brief Audio interrupt mode (such as phone call), 0 means pause play during interruption and resume play after interruption; 1 means continue play during interruption period.
*/
@property(nonatomic, assign) int audioInterruptMode;
/**
* 开始预加载阈值。单位ms
*/
/****
* start preload limit. Unit: milliseconds.
*/
@property(nonatomic, assign) int startBufferLimit;
/**
* 停止预加载阈值。单位ms
*/
/****
* stop preload limit. Unit: milliseconds.
*/
@property(nonatomic, assign) int stopBufferLimit;
@end
#endif /* AVPConfig_h */

View File

@@ -0,0 +1,403 @@
//
// AVPDef.h
// AVPSDK
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#ifndef AVPDef_h
#define AVPDef_h
#import <Foundation/Foundation.h>
#if TARGET_OS_OSX
#import <AppKit/AppKit.h>
#define AVPView NSView
#define AVPImage NSImage
#elif TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#define AVPView UIView
#define AVPImage UIImage
#endif // TARGET_OS_OSX
#import "AVPErrorCode.h"
/**
* Convert playback URL before playback.
*
* For vid playback, try to convert the playback URL before playback
*
* @param srcURL [in] input URL.
* @param srcFormat [in] input format. should be "m3u8" "mp4", or "" if unknown.
* @param destURL [out] output URL, convertURL function will malloc the memory, and user of PlayURLConverCallback need free it outside.
*
* @return true if success.
*/
typedef bool (*PlayURLConverCallback)(const char* srcURL, const char* srcFormat, char** destURL);
typedef enum AVPStatus: NSUInteger {
/** @brief 空转,闲时,静态 */
/**** @brief Idle */
AVPStatusIdle = 0,
/** @brief 初始化完成 */
/**** @brief Initialized */
AVPStatusInitialzed,
/** @brief 准备完成 */
/**** @brief Prepared */
AVPStatusPrepared,
/** @brief 正在播放 */
/**** @brief Playing */
AVPStatusStarted,
/** @brief 播放暂停 */
/**** @brief Paused */
AVPStatusPaused,
/** @brief 播放停止 */
/**** @brief Stopped */
AVPStatusStopped,
/** @brief 播放完成 */
/**** @brief Completed */
AVPStatusCompletion,
/** @brief 播放错误 */
/**** @brief Error */
AVPStatusError
} AVPStatus;
/**@brief 跳转模式,是否为精准跳转*/
/****@brief Seeking mode: accurate seeking or inaccurate seeking.*/
typedef enum AVPSeekMode: NSUInteger {
AVP_SEEKMODE_ACCURATE = 0x01,
AVP_SEEKMODE_INACCURATE = 0x10,
} AVPSeekMode;
/**@brief 渲染显示模式*/
/****@brief Zoom mode*/
typedef enum AVPScalingMode: NSUInteger {
/**@brief 不保持比例平铺*/
/****@brief Auto stretch to fit.*/
AVP_SCALINGMODE_SCALETOFILL,
/**@brief 保持比例,黑边*/
/****@brief Keep aspect ratio and add black borders.*/
AVP_SCALINGMODE_SCALEASPECTFIT,
/**@brief 保持比例填充,需裁剪*/
/****@brief Keep aspect ratio and crop.*/
AVP_SCALINGMODE_SCALEASPECTFILL,
} AVPScalingMode;
/**@brief 旋转模式*/
/****@brief Rotate mode*/
typedef enum AVPRotateMode: NSUInteger {
AVP_ROTATE_0 = 0,
AVP_ROTATE_90 = 90,
AVP_ROTATE_180 = 180,
AVP_ROTATE_270 = 270
} AVPRotateMode;
/**@brief 镜像模式*/
/****@brief Mirroring mode*/
typedef enum AVPMirrorMode: NSUInteger {
AVP_MIRRORMODE_NONE,
AVP_MIRRORMODE_HORIZONTAL,
AVP_MIRRORMODE_VERTICAL,
} AVPMirrorMode;
/**@brief 音频输出声道*/
/****@brief Output audio channel*/
typedef enum AVPOutputAudioChannel:NSUInteger {
/**@brief 不指定声道,默认值*/
/****@brief Not specified, default value*/
AVP_AUDIO_CHANNEL_NONE = 0,
/**@brief 左声道*/
/****@brief Left audio channel*/
AVP_AUDIO_CHANNEL_LEFT = 1,
/**@brief 右声道*/
/****@brief Right audio channel*/
AVP_AUDIO_CHANNEL_RIGHT = 2
} AVPOutputAudioChannel;
/**@brief 播放器事件类型*/
/****@brief Player event type*/
typedef enum AVPEventType: NSUInteger {
/**@brief 准备完成事件*/
/****@brief Preparation completion event*/
AVPEventPrepareDone,
/**@brief 自动启播事件*/
/****@brief Autoplay start event*/
AVPEventAutoPlayStart,
/**@brief 首帧显示事件*/
/****@brief First frame display event*/
AVPEventFirstRenderedStart,
/**@brief 播放完成事件*/
/****@brief Playback completion event*/
AVPEventCompletion,
/**@brief 缓冲开始事件*/
/****@brief Buffer start event*/
AVPEventLoadingStart,
/**@brief 缓冲完成事件*/
/****@brief Buffer completion event*/
AVPEventLoadingEnd,
/**@brief 跳转完成事件*/
/****@brief Seeking completion event*/
AVPEventSeekEnd,
/**@brief 循环播放开始事件*/
/****@brief Loop playback start event*/
AVPEventLoopingStart,
} AVPEventType;
/**@brief 获取信息播放器的key*/
/****@brief The key to get property*/
typedef enum AVPPropertyKey: NSUInteger {
/**@brief Http的response信息
* 返回的字符串是JSON数组每个对象带response和type字段。type字段可以是url/video/audio/subtitle根据流是否有相应Track返回。
* 例如:[{"response":"response string","type":"url"},{"response":"","type":"video"}]
*/
/****@brief Http response info
* Return with JSON arrayeach object item include 'response'/'type' filed。'type' could be url/video/audio/subtitle, depend on the stream whether have the tracks。
* For example: [{"response":"response string","type":"url"},{"response":"","type":"video"}]
*/
AVP_KEY_RESPONSE_INFO = 0,
/**@brief 主URL的连接信息
* 返回的字符串是JSON对象带url/ip/eagleID/cdnVia/cdncip/cdnsip等字段如果解析不到则不添加
* 例如:{"url":"http://xxx","openCost":23,"ip":"11.111.111.11","cdnVia":"xxx","cdncip":"22.222.222.22","cdnsip":"xxx"}
*/
/****@brief Major URL connect information
* Return with JSON objectinclude sub fileds such as url/ip/eagleID/cdnVia/cdncip/cdnsip.
* For example: {"url":"http://xxx","openCost":23,"ip":"11.111.111.11","cdnVia":"xxx","cdncip":"22.222.222.22","cdnsip":"xxx"}
*/
AVP_KEY_CONNECT_INFO = 1,
} AVPPropertyKey;
/**@brief IP 解析类型*/
/**@brief IP resolve type*/
typedef enum AVPIpResolveType: NSUInteger {
AVPIpResolveWhatEver,
AVPIpResolveV4,
AVPIpResolveV6,
} AVPIpResolveType;
typedef enum AVPOption : NSUInteger {
/**
* @brief 渲染的fps。类型为Float
*/
/****
* @brief render fps. Return value type is Float
*/
AVP_OPTION_RENDER_FPS = 0,
/**
* 当前的网络下行码率。类型为Float
*/
/****
* current download bitrate. Return value type is Float
*/
AVP_OPTION_DOWNLOAD_BITRATE = 1,
/**
* 当前播放的视频码率。类型为Float
*/
/****
* current playback video bitrate. Return value type is Float
*/
AVP_OPTION_VIDEO_BITRATE = 2,
/**
* 当前播放的音频码率。类型为Float
*/
/****
* current playback audio bitrate. Return value type is Float
*/
AVP_OPTION_AUDIO_BITRATE = 3,
} AVPOption;
/**
* 策略类型
*/
/****
* strategy type
*/
typedef enum AVPStrategyType : NSUInteger {
/**
* 动态预加载时长策略
*/
/****
* dynamic preload duration strategy.
*/
AVP_STRATEGY_DYNAMIC_PRELOAD = 1,
} AVPStrategyType;
/**
* 场景类型
*/
/****
* scene type
*/
typedef enum AVPSceneType : NSInteger {
/**
* 场景:无
*/
/****
* scene none
*/
AVP_SCENE_NONE = -1,
/**
* 超短视频场景适用于30s以下
*/
/****
* very short scene: apply to less 30s
*/
AVP_VERY_SHOR_VIDEO = 0,
/**
* 短视频场景适用于30s-5min
*/
/****
* short scene: apply to 30-5min
*/
AVP_SHORT_VIDEO = 1,
/**
* 中视频场景适用于5min-30min
*/
/****
* middle scene: apply to 5min-30min
*/
AVP_MIDDLE_VIDEO = 2,
/**
* 长视频场景适用于30min以上
*/
/****
* long scene: apply to more than 30min
*/
AVP_LONG_VIDEO = 3,
} AVPSceneType;
/**
@brief AVPErrorModel为播放错误信息描述
*/
/****
@brief AVPErrorModel represents playback error descriptions.
*/
OBJC_EXPORT
@interface AVPErrorModel : NSObject
/**
@brief code为播放错误信息code
*/
/****
@brief code represents a playback error code.
*/
@property (nonatomic, assign) AVPErrorCode code;
/**
@brief message为播放错误信息描述
*/
/****
@brief message represents a playback error message.
*/
@property (nonatomic, copy) NSString *message;
/**
@brief extra为播放错误信息描述的附加信息
*/
/****
@brief extra represents an additional playback error message.
*/
@property (nonatomic, copy) NSString *extra;
/**
@brief requestId为播放错误信息requestID
*/
/****
@brief requestId represents the request ID of a playback error.
*/
@property (nonatomic, copy) NSString *requestId;
/**
@brief videoId为播放错误发生的videoID
*/
/****
@brief videoId represents the VID of the video that has a playback error.
*/
@property (nonatomic, copy) NSString *videoId;
@end
/**
@brief AVPTimeShiftModel直播时移描述
*/
/****
@brief AVPTimeShiftModel represents broadcasting timeshift descriptions.
*/
OBJC_EXPORT
@interface AVPTimeShiftModel : NSObject
/**
@brief startTime直播时移开始时间
*/
/****
@brief startTime represents the start of the time range for broadcasting timeshift.
*/
@property (nonatomic, assign) NSTimeInterval startTime;
/**
@brief endTime直播时移结束时间
*/
/****
@brief endTime represents the end of the time range for broadcasting timeshift.
*/
@property (nonatomic, assign) NSTimeInterval endTime;
/**
@brief currentTime直播时移当前时间
*/
/****
@brief currentTime represents the time that broadcasting timeshift seeks to.
*/
@property (nonatomic, assign) NSTimeInterval currentTime;
@end
/**
@brief logLevel
*/
typedef enum AVPLogLevel: NSUInteger {
LOG_LEVEL_NONE = 0,
LOG_LEVEL_FATAL = 8,
LOG_LEVEL_ERROR = 16,
LOG_LEVEL_WARNING = 24,
LOG_LEVEL_INFO = 32,
LOG_LEVEL_DEBUG = 48,
LOG_LEVEL_TRACE = 56,
} AVPLogLevel;
typedef enum _AVPStsStatus {
Valid,
Invalid,
Pending } AVPStsStatus;
typedef struct _AVPStsInfo {
NSString *accId;
NSString *accSecret;
NSString *token;
NSString *region;
NSString *formats;
} AVPStsInfo;
/**
@brief 是否支持的功能的类型
*/
/****
@brief The type of the feature.
*/
typedef enum _SupportFeatureType : NSUInteger {
/**
* 硬件是否支持杜比音频
*/
/****
* whether the device support Dolby Audio.
*/
FeatureDolbyAudio
} SupportFeatureType;
#endif /* AVPDef_h */

View File

@@ -0,0 +1,358 @@
//
// AVPDelegate.h
// AliPlayerSDK
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#ifndef AVPDelegate_h
#define AVPDelegate_h
@class AliPlayer;
@class AVPTrackInfo;
#import <Foundation/Foundation.h>
#import "AVPDef.h"
@protocol AVPDelegate <NSObject>
@optional
/**
@brief 播放器事件回调
@param player 播放器player指针
@param eventType 播放器事件类型
@see AVPEventType
*/
/****
@brief Player event callback.
@param player Player pointer.
@param eventType Player event type.
@see AVPEventType
*/
-(void)onPlayerEvent:(AliPlayer*)player eventType:(AVPEventType)eventType;
/**
@brief 播放器事件回调
@param player 播放器player指针
@param eventWithString 播放器事件类型
@param description 播放器事件说明
@see AVPEventType
*/
/****
@brief Player event callback.
@param player Player pointer.
@param eventWithString Player event type.
@param description Player event description.
@see AVPEventType
*/
-(void)onPlayerEvent:(AliPlayer*)player eventWithString:(AVPEventWithString)eventWithString description:(NSString *)description;
/**
@brief 错误代理回调
@param player 播放器player指针
@param errorModel 播放器错误描述参考AVPErrorModel
@see AVPErrorModel
*/
/****
@brief Proxy error callback.
@param player Player pointer.
@param errorModel Player error description. See AVPErrorModel.
@see AVPErrorModel
*/
- (void)onError:(AliPlayer*)player errorModel:(AVPErrorModel *)errorModel;
/**
@brief 视频大小变化回调
@param player 播放器player指针
@param width 视频宽度
@param height 视频高度
@param rotation 视频旋转角度
*/
/****
@brief Video size change callback.
@param player Player pointer.
@param width Video width.
@param height Video height.
@param rotation Video rotate angle.
*/
- (void)onVideoSizeChanged:(AliPlayer*)player width:(int)width height:(int)height rotation:(int)rotation;
/**
@brief 视频当前播放位置回调
@param player 播放器player指针
@param position 视频当前播放位置
*/
/****
@brief Current playback position callback.
@param player Player pointer.
@param position Current playback position.
*/
- (void)onCurrentPositionUpdate:(AliPlayer*)player position:(int64_t)position;
/**
@brief 视频当前播放内容对应的utc时间回调
@param player 播放器player指针
@param time utc时间
*/
/****
@brief Current playback utc time callback.
@param player Player pointer.
@param position Current utc time.
*/
- (void)onCurrentUtcTimeUpdate:(AliPlayer *)player time:(int64_t)time;
/**
@brief 视频当前播放缓存命中回调
@param player 播放器player指针
@param size 文件大小
*/
/****
@brief Current playback cached file size callback.
@param player Player pointer.
@param size file size.
*/
- (void)onLocalCacheLoaded:(AliPlayer *)player size:(int64_t)size;
/**
@brief 视频缓存位置回调
@param player 播放器player指针
@param position 视频当前缓存位置
*/
/****
@brief Current cache position callback.
@param player Player pointer.
@param position Current cache position.
*/
- (void)onBufferedPositionUpdate:(AliPlayer*)player position:(int64_t)position;
/**
@brief 视频缓冲进度回调
@param player 播放器player指针
@param progress 缓存进度0-100
*/
/****
@brief Buffer progress callback.
@param player Player pointer.
@param progress Buffer progress: from 0 to 100.
*/
- (void)onLoadingProgress:(AliPlayer*)player progress:(float)progress;
/**
@brief 当前下载速度回调
@param player 播放器player指针
@param speed bits per second
*/
/****
@brief current download speed callback.
@param player Player pointer.
@param speed bits per second.
*/
- (void)onCurrentDownloadSpeed:(AliPlayer *)player speed:(int64_t)speed;
/**
@brief 获取track信息回调
@param player 播放器player指针
@param info track流信息数组
@see AVPTrackInfo
*/
/****
@brief Track information callback.
@param player Player pointer.
@param info An array of track information.
@see AVPTrackInfo
*/
- (void)onTrackReady:(AliPlayer*)player info:(NSArray<AVPTrackInfo*>*)info;
/**
@brief 选择希望播放的流
@param player 播放器player指针
@param info track流信息数组
@see AVPTrackInfo
*/
- (int)onChooseTrackIndex:(AliPlayer *)player info:(NSArray<AVPTrackInfo *> *)info;
/**
@brief track切换完成回调
@param player 播放器player指针
@param info 切换后的信息 参考AVPTrackInfo
@see AVPTrackInfo
*/
/****
@brief Track switchover completion callback.
@param player Player pointer.
@param info Track switchover completion information. See AVPTrackInfo.
@see AVPTrackInfo
*/
- (void)onTrackChanged:(AliPlayer*)player info:(AVPTrackInfo*)info;
/**
@brief 外挂字幕被添加
@param player 播放器player指针
@param index 字幕显示的索引号
@param URL 字幕url
*/
/****
@brief External subtitles have been added
@param player Player pointer.
@param trackIndex Subtitle index.
@param URL subtitle url
*/
- (void)onSubtitleExtAdded:(AliPlayer*)player trackIndex:(int)trackIndex URL:(NSString *)URL;
/**
@brief 字幕头信息回调ass字幕如果实现了此回调则播放器不会渲染字幕由调用者完成渲染否则播放器自动完成字幕的渲染
@param player 播放器player指针
@param index 字幕显示的索引号
@param header 头内容
*/
/****
@brief subtitle header info callback,
for ass, player will not render the subtitle when this is implemented by user
@param player Player pointer.
@param trackIndex Subtitle index.
@param URL subtitle url
*/
- (void)onSubtitleHeader:(AliPlayer *)player trackIndex:(int)trackIndex Header:(NSString *)header;
/**
@brief 字幕显示回调
@param player 播放器player指针
@param trackIndex 字幕流索引.
@param subtitleID 字幕ID.
@param subtitle 字幕显示的字符串
*/
/****
@brief Show subtitle callback.
@param player Player pointer.
@param trackIndex Subtitle stream index.
@param subtitleID Subtitle ID.
@param subtitle Subtitle string.
*/
- (void)onSubtitleShow:(AliPlayer*)player trackIndex:(int)trackIndex subtitleID:(long)subtitleID subtitle:(NSString *)subtitle;
/**
@brief 字幕隐藏回调
@param player 播放器player指针
@param trackIndex 字幕流索引.
@param subtitleID 字幕ID.
*/
/****
@brief Hide subtitle callback.
@param player Player pointer.
@param trackIndex Subtitle stream index.
@param subtitleID Subtitle ID.
*/
- (void)onSubtitleHide:(AliPlayer*)player trackIndex:(int)trackIndex subtitleID:(long)subtitleID;
/**
@brief 获取缩略图成功回调
@param positionMs 指定的缩略图位置
@param fromPos 此缩略图的开始位置
@param toPos 此缩略图的结束位置
@param image 缩图略图像指针,对于mac是NSImageiOS平台是UIImage指针
*/
/****
@brief Thumbnail image retrieval success callback.
@param positionMs The specified thumbnail image position.
@param fromPos The initial position of the thumbnail image.
@param toPos The end position of the thumbnail image.
@param image Thumbnail image pointer. Mac: NSImage. iOS: UIImage.
*/
- (void)onGetThumbnailSuc:(int64_t)positionMs fromPos:(int64_t)fromPos toPos:(int64_t)toPos image:(id)image;
/**
@brief 获取缩略图失败回调
@param positionMs 指定的缩略图位置
*/
/****
@brief Thumbnail image retrieval failure callback.
@param positionMs The specified thumbnail image position.
*/
- (void)onGetThumbnailFailed:(int64_t)positionMs;
/**
@brief 播放器状态改变回调
@param player 播放器player指针
@param oldStatus 老的播放器状态 参考AVPStatus
@param newStatus 新的播放器状态 参考AVPStatus
@see AVPStatus
*/
/****
@brief Player status update callback.
@param player Player pointer.
@param oldStatus The previous status. See AVPStatus.
@param newStatus The updated status. See AVPStatus.
@see AVPStatus
*/
- (void)onPlayerStatusChanged:(AliPlayer*)player oldStatus:(AVPStatus)oldStatus newStatus:(AVPStatus)newStatus;
/**
@brief 获取截图回调
@param player 播放器player指针
@param image 图像
@see AVPImage
*/
/****
@brief Snapshot retrieval callback.
@param player Player pointer.
@param image Snapshot.
@see AVPImage
*/
- (void)onCaptureScreen:(AliPlayer*)player image:(AVPImage*)image;
/**
@brief SEI回调
@param player 播放器player指针
@param type 类型
@param data 数据
@see AVPImage
*/
/****
@brief SEI callback.
@param player Player pointer.
@param type Type.
@param data Data.
@see AVPImage
*/
- (void)onSEIData:(AliPlayer*)player type:(int)type data:(NSData *)data;
/**
@brief 播放器渲染信息回调
@param player 播放器player指针
@param timeMs 渲染时的系统时间
@param pts 视频帧pts
*/
/****
@brief Player render info callback.
@param player Player pointer.
@param timeMs system time when render.
@param pts video frame pts
@see AVPEventType
*/
-(void)onVideoRendered:(AliPlayer*)player timeMs:(int64_t)timeMs pts:(int64_t)pts;
@end
/**
@brief 埋点事件参数回调
*/
/****
@brief Event report params
*/
@protocol AVPEventReportParamsDelegate <NSObject>
/**
@brief 回调
@param params 埋点事件参数
*/
/****
@brief call back
@param params event params
*/
-(void)onEventReportParams:(NSDictionary<NSString *, NSString *>*)params;
@end
#endif /* AVPDelegate_h */

View File

@@ -0,0 +1,458 @@
#ifndef AVPErrorCode_h
#define AVPErrorCode_h
typedef enum AVPErrorCode: NSUInteger {
/**@brief 服务器返回数据为空。*/
/****@brief The server returns no response.*/
ERROR_SERVER_NO_RESPONSE = 0x20010001,
/**@brief 服务器返回数据不为json格式。*/
/****@brief The response returned by the server is not in JSON format.*/
ERROR_SERVER_WRONG_JSON = 0x20010002,
/**@brief 没有找到匹配的清晰度。*/
/****@brief No resolution matching the request is available.*/
ERROR_NO_MATCH_QUALITY = 0x20010003,
/**@brief PlayAuth解析错误。*/
/****@brief A playAuth parsing error has occurred.*/
ERROR_PLAYAUTH_WRONG = 0x20010004,
/**@brief 请求失败。*/
/****@brief The request failed.*/
ERROR_REQUEST_FAIL = 0x20010005,
/**@brief 服务端返回播放信息为空。*/
/****@brief The server returns no playback information. */
ERROR_NO_PLAY_INFO = 0x20010006,
//------------------ POP begin ------------------------
/**@brief POP未知错误。*/
/****@brief An unknown POP error has occurred. */
ERROR_SERVER_POP_UNKNOWN = 0x20010100,
/**@brief 缺少参数。*/
/****@brief A parameter is missing.*/
ERROR_SERVER_POP_MISSING_PARAMETER = 0x20010101,
/**@brief 参数无效。*/
/****@brief A parameter is invalid.*/
ERROR_SERVER_POP_INVALID_PARAMETER = 0x20010102,
/**@brief 账号未开通视频点播服务。*/
/****@brief ApsaraVideo for VOD has not been activated for your account.*/
ERROR_SERVER_POP_OPERATION_DENIED = 0x20010103,
/**@brief 账号已欠费,请充值。*/
/****@brief Your account has overdue payments. Recharge your account.*/
ERROR_SERVER_POP_OPERATION_SUSPENED = 0x20010104,
/**@brief 无权限执行该操作。*/
/****@brief You are not authorized to perform the operation.*/
ERROR_SERVER_POP_FORBIDDEN = 0x20010105,
/**@brief 后台发生未知错误。*/
/****@brief An unknown error has occurred in the background.*/
ERROR_SERVER_POP_INTERNAL_ERROR = 0x20010106,
/**@brief 服务不可用。*/
/****@brief The service is unavailable.*/
ERROR_SERVER_POP_SERVICE_UNAVALIABLE = 0x20010107,
/**@brief 签名已经被使用。*/
/****@brief The signature has been used.*/
ERROR_SERVER_POP_SIGNATUREANONCE_USED = 0x20010108,
/**@brief 安全token不对。*/
/****@brief The security token is incorrect.*/
ERROR_SERVER_POP_SECURITYTOKEN_MAILFORMED = 0x20010109,
/**@brief 安全token与Accesskey不匹配。*/
/****@brief The security token and AccessKey do not match.*/
ERROR_SERVER_POP_SECURITYTOKEN_MISMATCH_ACCESSKEY = 0x2001010A,
/**@brief 签名校验不对。*/
/****@brief The signature is incorrect.*/
ERROR_SERVER_POP_SIGNATURE_NOT_MATCH = 0x2001010B,
/**@brief 没有找到AccessKeyId。*/
/****@brief The AccessKey ID does not exist.*/
ERROR_SERVER_POP_ACCESSKEYID_NOT_FOUND = 0x2001010C,
/**@brief Token过期。*/
/****@brief The token is expired.*/
ERROR_SERVER_POP_TOKEN_EXPIRED = 0x2001010D,
//------------------ VOD begin ------------------------
/**@brief VOD未知错误。*/
/****@brief An unknown VOD error has occurred.*/
ERROR_SERVER_VOD_UNKNOWN = 0x20010200,
/**@brief 视频状态无效。*/
/****@brief The video status is invalid.*/
ERROR_SERVER_VOD_FORBIDDEN_ILLEGALSTATUS = 0x20010201,
/**@brief 视频不存在。*/
/****@brief The specified video does not exist.*/
ERROR_SERVER_VOD_INVALIDVIDEO_NOTFOUND = 0x20010202,
/**@brief 根据您的筛选条件找不到可以播放的转码输出流。*/
/****@brief No transcoded stream file available for playback is found based on the specified filter criteria.*/
ERROR_SERVER_VOD_INVALIDVIDEO_NOSTREAM = 0x20010203,
/**@brief 当前仅存在阿里云视频加密的转码输出流必须使用阿里云播放器进行播放或者设置请求参数ResultType值为Multiple。*/
/****@brief Only transcoded stream files encrypted by the Alibaba Cloud video encryption service exist. You must use ApsaraVideo Player to play the files or set the ResultType parameter to Multiple.*/
ERROR_SERVER_VOD_FORBIDDEN_ALIYUNVODENCRYPTION = 0x20010204,
/**@brief AuthInfo与vid不一致。*/
/****@brief The authentication information and the video ID (VID) do not match.*/
ERROR_SERVER_VOD_INVALIDAUTH_MEDIAID = 0x20010205,
/**@brief AuthInfo过期。*/
/****@brief The authentication information has expired.*/
ERROR_SERVER_VOD_INVALIDAUTHINFO_EXPIRETIME = 0x20010206,
//------------------ MPS begin ------------------------
/**@brief MPS未知错误。*/
/****@brief An unknown ApsaraVideo for Media Processing (MPS) error has occurred.*/
ERROR_SERVER_MPS_UNKNOWN = 0x20010300,
/**@brief MediaId无效。*/
/****@brief The media ID is invalid.*/
ERROR_SERVER_MPS_INVALID_MEDIAID = 0x20010301,
/**@brief AuthTimeout无效。*/
/****@brief The authentication expiration time is invalid.*/
ERROR_SERVER_MPS_INVALID_AUTHTIMEOUT = 0x20010302,
/**@brief Formats无效。*/
/****@brief The media format is invalid.*/
ERROR_SERVER_MPS_INVALID_FORMATS = 0x20010303,
/**@brief AuthInfo无效。*/
/****@brief The authentication information is invalid.*/
ERROR_SERVER_MPS_INVALID_AUTHINFO = 0x20010304,
/**@brief 签名校验失败。*/
/****@brief The signature failed verification.*/
ERROR_SERVER_MPS_SIGNATURE_CHECK_FAILED = 0x20010305,
/**@brief MediaId不存在。*/
/****@brief The media ID does not exist.*/
ERROR_SERVER_MPS_MEDIAID_NOT_EXIST = 0x20010306,
/**@brief 媒体资源不存在。*/
/****@brief The media resource does not exist.*/
ERROR_SERVER_MPS_MEDIA_RESOURCE_NOT_EXIST = 0x20010307,
/**@brief 媒体没有发布。*/
/****@brief The media is not published.*/
ERROR_SERVER_MPS_MEDIA_NOT_PUBLISHED = 0x20010308,
/**@brief 媒体没有加密。*/
/****@brief The media is not encrypted.*/
ERROR_SERVER_MPS_MEDIA_NOT_ENCRYPTED = 0x20010309,
/**@brief ciphertextblob无效。*/
/****@brief The ciphertextBlob string is invalid.*/
ERROR_SERVER_MPS_INVALID_CIPHERTEXTBLOB = 0x2001030A,
/**@brief CipherTextBlob不存在。*/
/****@brief The ciphertextBlob string does not exist.*/
ERROR_SERVER_MPS_CIPHERBLOB_NOT_EXIST = 0x2001030B,
/**@brief 服务器内部错误。*/
/****@brief An internal server error has occurred.*/
ERROR_SERVER_MPS_INTERNAL_ERROR = 0x2001030C,
/**@brief 请求标识不允许操作。*/
/****@brief You are not authorized to perform the operation.*/
ERROR_SERVER_MPS_INVALID_IDENTITY_NOT_ORDER_VIDEO_SERVICE = 0x2001030D,
/**@brief 更新主机配置失败。*/
/****@brief The host configuration failed to be updated.*/
ERROR_SERVER_MPS_UPDATE_CDN_DOMAIN_CONFIGS_FAIL = 0x2001030E,
/**@brief auth密钥已经存在。*/
/****@brief The AccessKey secret for authentication has been used by another account.*/
ERROR_SERVER_MPS_AUTH_KEY_EXIST = 0x2001030F,
/**@brief auth密钥不存在。*/
/****@brief The AccessKey secret for authentication does not exist.*/
ERROR_SERVER_MPS_AUTH_KEY_NOT_EXIST = 0x20010310,
/**@brief 参数超出范围。*/
/****@brief The parameter value is out of the value range.*/
ERROR_SERVER_MPS_INVALID_PARAMETER_OUT_OF_BOUND = 0x20010311,
/**@brief 参数无效。*/
/****@brief The parameter is invalid.*/
ERROR_SERVER_MPS_INVALID_PARAMETER = 0x20010312,
/**@brief 参数不能为null。*/
/****@brief The parameter value is null. You must specify the parameter.*/
ERROR_SERVER_MPS_INVALID_PARAMETER_NULL_VALUE = 0x20010313,
/**@brief 参数不能为空。*/
/****@brief The parameter value is empty. You must specify a non-empty value for the parameter.*/
ERROR_SERVER_MPS_INVALID_PARAMETER_EMPTY_VALUE = 0x20010314,
/**@brief 媒体资源不匹配。*/
/****@brief The media resource is not supported.*/
ERROR_SERVER_MPS_MEDIA_RESOURCE_NOT_MATCH = 0x20010315,
/**@brief 没有找到MediaId的密文资源。*/
/****@brief The ciphertext of the media ID is not found.*/
ERROR_SERVER_MPS_MEDIA_NOT_FOUND_CIPHERTEXT = 0x20010316,
/**@brief 指定的参数Rand无效。*/
/****@brief The specified rand parameter is invalid.*/
ERROR_SERVER_MPS_INVALID_PARAMETER_RAND = 0x20010317,
/**@brief 缓存连接池为空。*/
/****@brief The Redis cache connection pool is empty.*/
ERROR_SERVER_MPS_REDIS_POOL_IS_EMPTY = 0x20010318,
/**@brief 媒体id不匹配。*/
/****@brief The signature and the media ID do not match.*/
ERROR_SERVER_MPS_SIGNATURE_CHECK_MEDIA_FAILED = 0x20010319,
/**@brief 指定的到期时间值已过期。*/
/****@brief The specified timeout value has expired.*/
ERROR_SERVER_MPS_SIGNATURE_CHECK_EXPIREDTIME_FAILED = 0x2001031A,
/**@brief 指定的参数SessionTime应该是>0。*/
/****@brief The value of the SessionTime parameter is not greater than 0. Set the parameter to a value greater than 0.*/
ERROR_SERVER_MPS_INVALID_SESSION_TIME = 0x2001031B,
/**@brief EndUserId长度不对。*/
/****@brief The length of the EndUserId parameter is incorrect.*/
ERROR_SERVER_MPS_INVALID_END_USER_ID = 0x2001031C,
/**@brief 指定的参数LicenseUrl格式不正确。*/
/****@brief The format of the LicenseUrl parameter is incorrect.*/
ERROR_SERVER_MPS_INVALID_URL = 0x2001031D,
/**@brief 请求失败。*/
/****@brief The request failed.*/
ERROR_SERVER_MPS_HTTP_REQUEST_FAILED = 0x2001031E,
/**@brief xml格式出错。*/
/****@brief The XML format is incorrect.*/
ERROR_SERVER_MPS_XML_FORMAT_ERROR = 0x2001031F,
/**@brief Session不存在。*/
/****@brief The session does not exist.*/
ERROR_SERVER_MPS_SESSION_NOT_EXIST = 0x20010320,
/**@brief API不支持。*/
/****@brief The API is not supported.*/
ERROR_SERVER_MPS_REGION_NOT_SUPPORTED_API = 0x20010321,
/**@brief 此区域未激活DRM请联系我们。*/
/****@brief Digital rights management (DRM) is not authorized for this region. Contact ApsaraVideo for VOD technical support.*/
ERROR_SERVER_MPS_DRM_NOT_ACTIVATED = 0x20010322,
/**@brief DRM验证错误请为此媒体添加授权。*/
/****@brief DRM verification failed. Authorize DRM for the media.*/
ERROR_SERVER_MPS_DRM_AUTH_ERROR = 0x20010323,
/**@brief oss域不存在cdn域配置。*/
/****@brief No Content Delivery Network (CDN) domain name is bound to your Object Storage Service (OSS) bucket.*/
ERROR_SERVER_MPS_CDN_CONFIG_NOT_EXIST = 0x20010324,
//------------------ LIVESHIFT begin ------------------------
/**@brief 时移未知错误。*/
/****@brief An unknown time shifting error has occurred.*/
ERROR_SERVER_LIVESHIFT_UNKNOWN = 0x20010400,
/**@brief 时移请求失败。*/
/****@brief The time shifting request failed.*/
ERROR_SERVER_LIVESHIFT_REQUEST_ERROR = 0x20010401,
/**@brief 时移数据解析失败。*/
/****@brief The time shifting data failed to be parsed.*/
ERROR_SERVER_LIVESHIFT_DATA_PARSER_ERROR = 0x20010402,
//------------------ KEYMANANGER begin ------------------------
ERROR_KEYMANAGER_UNKNOWN = 0x20011000,
//------------------ TBDRM begin ------------------------
/**@brief 私有加密未知错误。*/
/****@brief An unknown error has occurred.*/
ERROR_TBDRM_UNKNOWN = 0x20012000,
/**@brief 私有加密解封装未实现。*/
/****@brief Transcoded streams encrypted by Alibaba Cloud video encryption cannot be decapsulated.*/
ERROR_TBDRM_DEMUXER_UNIMPLEMENTED = 0x20012001,
//------------------ UNKNOWN begin ------------------------
/**@brief 未知错误。*/
/****@brief An unknown error has occurred.*/
ERROR_UNKNOWN_ERROR = 0x20020000 - 1,
/**@brief Demuxer错误起始码。*/
/****@brief Demuxer error codes.*/
ERROR_DEMUXER_START = 0x20030000,
/**@brief 打开URL失败。*/
/****@brief The URL is unavailable.*/
ERROR_DEMUXER_OPENURL = 0x20030001,
/**@brief 无效的流。*/
/****@brief The stream is invalid.*/
ERROR_DEMUXER_NO_VALID_STREAM = 0x20030002,
/**@brief 打开流失败。*/
/****@brief The stream is unavailable.*/
ERROR_DEMUXER_OPENSTREAM = 0x20030003,
/**@brief 加载超时。*/
/****@brief The loading times out.*/
ERROR_LOADING_TIMEOUT = 0x20030004,
/**@brief 数据源URL为空。*/
/****@brief The data source URL is not specified.*/
ERROR_DATASOURCE_EMPTYURL = 0x20030005,
ERROR_DECODE_BASE = 0x20040000,
/**@brief 视频解码失败。*/
/****@brief The video decoding failed.*/
ERROR_DECODE_VIDEO = 0x20040001,
/**@brief 音频解码失败。*/
/****@brief The audio decoding failed.*/
ERROR_DECODE_AUDIO = 0x20040002,
/**@brief 未知的网络错误。*/
/****@brief An unknown network error has occurred.*/
ERROR_NETWORK_UNKNOWN = 0x20050000,
/**@brief 协议不支持。*/
/****@brief The protocol is not supported.*/
ERROR_NETWORK_UNSUPPORTED = 0x20050001,
/**@brief 不能解析域名。*/
/****@brief The domain name cannot be resolved.*/
ERROR_NETWORK_RESOLVE = 0x20050002,
/**@brief 网络连接超时。*/
/****@brief The network connection times out.*/
ERROR_NETWORK_CONNECT_TIMEOUT = 0x20050003,
/**@brief 无法连接到服务器。*/
/****@brief The server is unavailable.*/
ERROR_NETWORK_COULD_NOT_CONNECT = 0x20050004,
/**@brief 403错误。*/
/****@brief An HTTP 403 error has occurred.*/
ERROR_NETWORK_HTTP_403 = 0x20050005,
/**@brief 404错误。*/
/****@brief An HTTP 404 error has occurred.*/
ERROR_NETWORK_HTTP_404 = 0x20050006,
/**@brief 其他的4XX错误。*/
/****@brief An HTTP 4xx error other than HTTP 403 or HTTP 404 has occurred.*/
ERROR_NETWORK_HTTP_4XX = 0x20050007,
/**@brief 5XX的服务器错误。*/
/****@brief An HTTP 5xx error has occurred.*/
ERROR_NETWORK_HTTP_5XX = 0x20050008,
/**@brief 不支持range请求。*/
/****@brief The HTTP range request is not supported.*/
ERROR_NETWORK_HTTP_RANGE = 0x20050009,
/**@brief 400错误。*/
/****@brief An HTTP 400 error has occurred.*/
ERROR_NETWORK_HTTP_400 = 0x2005000A,
/**@brief 重定向到了一个不是媒体文件的URL。*/
/****@brief Redirect to a url that is not a media.*/
ERROR_NETWORK_HTTP_REDIRECT_NONMEDIA = 0x2005000B,
/**@brief 未知的解码错误。*/
/****@brief An unknown decoding error has occurred.*/
ERROR_CODEC_UNKNOWN = 0x20060000,
/**@brief 视频编码格式不支持。*/
/****@brief The video coding format is not supported.*/
ERROR_CODEC_VIDEO_NOT_SUPPORT = 0x20060001,
/**@brief 音频编码格式不支持。*/
/****@brief The audio coding format is not supported.*/
ERROR_CODEC_AUDIO_NOT_SUPPORT = 0x20060002,
/**@brief 未知的内部错误。*/
/****@brief An unknown internal error.*/
ERROR_INERNAL_UNKNOWN = 0x20070000,
/**@brief 内部退出。*/
/****@brief Exit.*/
ERROR_INERNAL_EXIT = 0x20070001,
/**@brief 标准错误。*/
/****@brief A standard error has occurred.*/
ERROR_GENERAL_UNKNOWN = 0x20080000,
/**@brief 标准错误-1操作不允许等。*/
/****@brief An EPERM error. The operation is not permitted.*/
ERROR_GENERAL_EPERM = 0x20080001,
/**@brief 标准错误-2文件不存在等。*/
/****@brief An ENOENT error. No such file or directory exists.*/
ERROR_GENERAL_ENOENT = 0x20080002,
/**@brief 标准错误-5IO错误等。*/
/****@brief An EIO error. An Input/Output (I/O) error has occurred.*/
ERROR_GENERAL_EIO = 0x20080005,
/**@brief 未知错误。*/
/****@brief .*/
ERROR_PLAYER_UNKNOWN = 0x30000000 - 1,
/**@brief 没有选择下载项。*/
/****@brief No track is selected for download.*/
DOWNLOADER_ERROR_NOT_SELECT_ITEM = 0x30010000,
/**@brief 没有可用下载项。*/
/****@brief No track is available for download.*/
DOWNLOADER_ERROR_NO_DOWNLOAD_ITEM = 0x30010001,
/**@brief 没有设置Sts源。*/
/****@brief The source for STS-based playback is not specified.*/
DOWNLOADER_ERROR_STS_SOURCE_NULL = 0x30010002,
/**@brief 没有设置Auth源。*/
/****@brief The source for playAuth-based playback is not specified.*/
DOWNLOADER_ERROR_AUTH_SOURCE_NULL = 0x30010003,
/**@brief Auth格式不对。*/
/****@brief The authentication format is incorrect.*/
DOWNLOADER_ERROR_AUTH_SOURCE_WRONG = 0x30010004,
/**@brief 选中的下载项不对。*/
/****@brief The selected track for download is invalid.*/
DOWNLOADER_ERROR_INVALID_ITEM = 0x30010005,
/**@brief URL无法连接。*/
/****@brief The URL is unavailable.*/
DOWNLOADER_ERROR_URL_CANNOT_REACH = 0x30010006,
/**@brief 下载的格式不支持。*/
/****@brief The format of the file to be downloaded is not supported.*/
DOWNLOADER_ERROR_NOT_SUPPORT_FORMAT = 0x30010007,
/**@brief 加密校验文件不匹配。*/
/****@brief The authentication information in the security file does not match the application information.*/
DOWNLOADER_ERROR_ENCRYPT_FILE_NOT_MATCH = 0x30010008,
/**@brief 下载功能被关闭。*/
/****@brief The download feature is disabled.*/
DOWNLOADER_ERROR_DOWNLOAD_SWITCH_OFF = 0x30010009,
/**@brief 网络出错。*/
/****@brief A network error has occurred.*/
DOWNLOADER_ERROR_NET_ERROR = 0x3001000A,
/**@brief 没有设置下载路径。*/
/****@brief The download directory is not specified.*/
DOWNLOADER_ERROR_NOT_SET_SAVE_DIR = 0x3001000B,
/**@brief 无法创建下载目录。*/
/****@brief The download directory cannot be created.*/
DOWNLOADER_ERROR_CANNOT_CREATE_SAVE_DIR = 0x3001000C,
/**@brief 没有空间。*/
/****@brief No sufficient space is available.*/
DOWNLOADER_ERROR_NO_SPACE = 0x3001000D,
/**@brief 写入文件出错。*/
/****@brief An error occurred while writing the data.*/
DOWNLOADER_ERROR_WRITE_ERROR = 0x3001000E,
/**@brief 解密失败。*/
/****@brief An error occurred while decrypting the data.*/
DOWNLOADER_ERROR_ENCRYPT_ERROR = 0x3001000F,
/**@brief 文件不存在。*/
/****@brief No such file exists.*/
DOWNLOADER_ERROR_FILE_NOT_EXIST = 0x30010010,
/**@brief 删除文件参数无效。*/
/****@brief The parameter that specifies the file to be deleted is invalid.*/
DOWNLOADER_ERROR_CLEAN_INVALID_PARAM = 0x30010011,
/**@brief 删除文件状态不对。*/
/****@brief The file status is incorrect. Only files in the stop status can be deleted.*/
DOWNLOADER_ERROR_CLEAN_WRONG_STATUS = 0x30010012,
/**@brief 获取AES秘钥失败。*/
/****@brief The AES key failed to be obtained.*/
DOWNLOADER_ERROR_GET_AES_KEY_FAIL = 0x30010013,
/**@brief 加密方式不支持。*/
/****@brief The encryption method is not supported.*/
DOWNLOADER_ERROR_ENCRYPTION_NOT_SUPPORT = 0x30010014,
} AVPErrorCode;
/**@brief 播放器事件类型,带描述字符串*/
/****@brief Player event type with a description string.*/
typedef enum AVPEventWithString: NSUInteger {
/**@brief 设置了硬解,但是切换为软解。额外信息为描述信息。*/
/****@brief Hardware decoding is switched to software decoding. Additional information: description.*/
EVENT_SWITCH_TO_SOFTWARE_DECODER = 100,
/**@brief 音频解码格式不支持。额外信息为描述信息。*/
/****@brief Audio decoding does not support the specified format. Additional information: description.*/
EVENT_AUDIO_CODEC_NOT_SUPPORT = 101,
/**@brief 音频解码器设备失败。额外信息为描述信息。*/
/****@brief The audio decoder failed. Additional information: description.*/
EVENT_AUDIO_DECODER_DEVICE_ERROR = 102,
/**@brief 视频解码格式不支持。额外信息为描述信息。*/
/****@brief Video decoding does not support the specified format. Additional information: description.*/
EVENT_VIDEO_CODEC_NOT_SUPPORT = 103,
/**@brief 视频解码器设备失败。额外信息为描述信息。*/
/****@brief The video decoder failed. Additional information: description.*/
EVENT_VIDEO_DECODER_DEVICE_ERROR = 104,
/**@brief 视频渲染设备初始化失败。额外信息为描述信息。*/
/****@brief The video renderer failed. Additional information: description.*/
EVENT_VIDEO_RENDER_INIT_ERROR = 105,
/**@brief Demuxer trace ID for artp*/
EVENT_PLAYER_DEMUXER_TRACE_ID = 106,
/**@brief 网络失败,需要重试。无额外信息。*/
/****@brief Network connection failed. Try again. No additional information is provided.*/
EVENT_PLAYER_NETWORK_RETRY = 108,
/**@brief 缓存成功。无额外信息。*/
/****@brief Content cached. No additional information is provided.*/
EVENT_PLAYER_CACHE_SUCCESS = 109,
/**@brief 缓存失败。额外信息为描述信息。*/
/****@brief Failed to cache the content. Additional information: description.*/
EVENT_PLAYER_CACHE_ERROR = 110,
/**@brief 系统无可用内存来存放媒体数据。*/
/****@brief The system does not have memory to store the media data.*/
EVENT_PLAYER_LOW_MEMORY = 111,
/**@brief 网络重试成功。无额外信息。*/
/****@brief Network retry successful. No additional information.*/
EVENT_PLAYER_NETWORK_RETRY_SUCCESS = 113,
/**@brief 字幕选择失败。额外信息为失败原因。*/
/****@brief Subtitle selection failed. Additional information is the cause of failure.*/
EVENT_PLAYER_SUBTITLE_SELECT_ERROR = 114,
/**@brief 后台恢复时所需解码帧过多 */
/****@brief decoder recover size is too large for background recovery.*/
EVENT_PLAYER_EVENT_DECODER_RECOVER_SIZE = 115,
/**@brief 播放组件中透传输出的消息 */
/****@brief The message passthrough the player component*/
EVENT_PLAYER_DIRECT_COMPONENT_MSG = 116,
/**@brief 打开hls流中的segment失败 */
/****@brief open segment failed when demux hls stream*/
EVENT_PLAYER_DEMUXER_SEGMENT_OPEN_FAILED = 119,
/**@brief RTS 服务器可能断开连接。*/
/****@brief RTS server maybe disconnect.*/
EVENT_PLAYER_RTS_SERVER_MAYBE_DISCONNECT = 0x30010001,
/**@brief RTS 服务器恢复连接。*/
/****@brief RTS server recover.*/
EVENT_PLAYER_RTS_SERVER_RECOVER = 0x30010002,
} AVPEventWithString;
#endif

View File

@@ -0,0 +1,60 @@
//
// Created by SuperMan on 2021/12/1.
//
#import <Foundation/Foundation.h>
@interface AVPFilterOptions : NSObject
/**
@brief 设置滤镜参数
*/
/****
@brief Set filter options
*/
- (void)setOptions:(NSString *)key value:(NSObject *)value;
- (NSString *)toJSONStr;
@end
@interface AVPFilter : NSObject
/**
@brief 创建滤镜
@param target 目标滤镜
*/
/****
@brief Init filter
@param target filter target
*/
- (instancetype)initWithTarget:(NSString *)target;
/**
@brief 设置滤镜参数
@param options
*/
/****
@brief Set filter options
@param options
*/
- (void)setOptions:(AVPFilterOptions *)options;
@end
@interface AVPFilterConfig : NSObject
/**
@brief 添加滤镜
@param filter
*/
/****
@brief Add filter
@param filter
*/
- (void)addFilter:(AVPFilter *)filter;
- (NSString *)toJSONStr;
@end

View File

@@ -0,0 +1,44 @@
//
// AVPHlsKeyGenerator.h
// AliPlayerSDK
//
//
#import <Foundation/Foundation.h>
@protocol AVPLiveKeyInfoDelegate <NSObject>
@required
/*
功能异步获取到m3u8中的URI解析出key将key相关信息回调出去如果有两个key则会回调两次
ekeyGenURL: 密文key的url
ekeyPreGenTime:在多少时间内必须要生成key这个时间可以用于打散如果time=0表示打散时间为0这个key必须要优先立即生成
*/
/***
Feature: Asynchronous key generation. Retrieve the URI from m3u8, parse the URI, generate a key, and then return the key information. If two keys are generated, two callbacks are required.
ekeyGenURL: The URL of the ciphertext key.
ekeyPreGenTime: The maximum key generation time. You can divide the time into multiple periods. If time=0, then the key must be generated immediately.
*/
-(void) onLiveKeyInfo:(NSString*)ekeyGenURL ekeyPreGenTime:(int)time userData: (NSString*)userData;
/*
功能同步通过密文key来获取到明文key
ekeyGenURL: 密文key的url
*/
/***
Feature: Synchronous key generation. Use a ciphertext key to generate a plaintext key.
ekeyGenURL: The URL of the ciphertext key.
*/
-(NSData*) onGetLiveKey:(NSString*)ekeyGenURL userData: (NSString*)userData;
@end
OBJC_EXPORT
@interface AVPLiveKeyGenerator : NSObject
+ (AVPLiveKeyGenerator *) getInstance;
@property(nonatomic,weak) id<AVPLiveKeyInfoDelegate> delegate;
@end

View File

@@ -0,0 +1,87 @@
//
// AVPLiveTimeShift.h
// AliPlayerSDK
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AliPlayer.h"
OBJC_EXPORT
@interface AVPLiveTimeShift : AliPlayer
/**
@brief 直播时移,打开直播时移播放地址
@param liveTimeUrl 直播时移播放地址
*/
/****
@brief Send a request to the broadcasting timeshift URL.
@param liveTimeUrl Broadcasting timeshift URL.
*/
- (void)prepareWithLiveTimeUrl:(NSString*)liveTimeUrl;
/**
@brief 直播时移,设置直播时移地址
@param liveTimeShiftUrl 直播时移请求地址
*/
/****
@brief Set a broadcasting timeshift URL.
@param liveTimeShiftUrl Broadcasting timeshift URL.
*/
- (void)setLiveTimeShiftUrl:(NSString*)liveTimeShiftUrl;
/**
@brief 直播时移,跳转到指定时移位置
@param startTime 跳转到直播startTime位置
*/
/****
@brief Seek to a specified position.
@param startTime Seek to the position specified by startTime in broadcasting.
*/
- (void)seekToLiveTime:(NSTimeInterval)startTime;
/**
@brief 直播时移,获取直播时间
*/
/****
@brief Query the broadcasting time.
*/
@property (nonatomic, assign) NSTimeInterval liveTime;
/**
@brief 直播时移,获取当前播放时间
*/
/****
@brief Query the current playback time.
*/
@property (nonatomic, assign) NSTimeInterval currentPlayTime;
/**
@brief 直播时移每60秒更新用户时移时间参考AliyunPlayerVideoTimeShiftModel
*/
/****
@brief Update the user timeshifting time at an interval of 60 seconds. See AliyunPlayerVideoTimeShiftModel.
*/
@property (nonatomic, strong) AVPTimeShiftModel *timeShiftModel;
/**
@brief 停止播放
*/
/****
@brief Stop the player.
*/
-(void)stop;
/**
@brief 开始播放
*/
/****
@brief Start the player.
*/
-(void)start;
@end

View File

@@ -0,0 +1,187 @@
//
// AVPMediaInfo.h
// AliPlayerSDK
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#ifndef AVPMediaInfo_h
#define AVPMediaInfo_h
#import <Foundation/Foundation.h>
const static int SELECT_AVPTRACK_TYPE_VIDEO_AUTO = -1;
/**
@brief track type
* AVPTRACK_TYPE_VIDEO: video track
* AVPTRACK_TYPE_AUDIO: audio track
* AVPTRACK_TYPE_SUBTITLE: subtitle track
* AVPTRACK_TYPE_MIXED: have auido and video info in this track
*/
typedef enum AVPTrackType: NSUInteger {
AVPTRACK_TYPE_VIDEO,
AVPTRACK_TYPE_AUDIO,
AVPTRACK_TYPE_SUBTITLE,
AVPTRACK_TYPE_SAAS_VOD,//track from vod
} AVPTrackType;
OBJC_EXPORT
@interface AVPTrackInfo : NSObject
/**
@brief track type @see AVPTrackType
*/
@property (nonatomic, assign) AVPTrackType trackType;
/**
@brief vod format
*/
@property (nonatomic, copy) NSString* vodFormat;
/**
@brief track index
*/
@property (nonatomic, assign) int trackIndex;
/**
@brief track definition, only meaningful if the trackType is AVPTRACK_TYPE_SAAS_VOD
*/
@property (nonatomic, copy) NSString* trackDefinition;
/**
@brief vod file size, only meaningful if the trackType is AVPTRACK_TYPE_SAAS_VOD
*/
@property (nonatomic, assign) int64_t vodFileSize;
/**
@brief vod play URL, only meaningful if the trackType is AVPTRACK_TYPE_SAAS_VOD
*/
@property (nonatomic, copy) NSString* vodPlayUrl;
/**
@brief waterMark URL, only meaningful if the trackType is AVPTRACK_TYPE_SAAS_VOD
*/
@property (nonatomic, copy) NSString* waterMarkUrl;
/**
@brief video width, only meaningful if the trackType is AVPTRACK_TYPE_VIDEO
*/
@property (nonatomic, assign) int videoWidth;
/**
@brief video height, only meaningful if the trackType is AVPTRACK_TYPE_VIDEO
*/
@property (nonatomic, assign) int videoHeight;
/**
@brief bitrate, only meaningful if the trackType is AVPTRACK_TYPE_VIDEO
*/
@property (nonatomic, assign) int trackBitrate;
/**
@brief the number of audio channel, only meaningful if the trackType is AVPTRACK_TYPE_AUDIO
*/
@property (nonatomic, assign) int audioChannels;
/**
@brief audio samplerate, only meaningful if the trackType is AVPTRACK_TYPE_AUDIO
*/
@property (nonatomic, assign) int audioSamplerate;
/**
@brief audio sampleFormat, only meaningful if the trackType is AVPTRACK_TYPE_AUDIO
*/
@property (nonatomic, assign) int audioSampleFormat;
/**
@brief audio Language, only meaningful if the trackType is AVPTRACK_TYPE_AUDIO
*/
@property (nonatomic, copy) NSString* audioLanguage;
/**
@brief subtitle Language, only meaningful if the trackType is AVPTRACK_TYPE_SUBTITLE
*/
@property (nonatomic, copy) NSString* subtitleLanguage;
@end
OBJC_EXPORT
@interface AVPThumbnailInfo : NSObject
/**
@brief thumbnail URL
*/
@property (nonatomic, copy) NSString* URL;
@end
OBJC_EXPORT
@interface AVPMediaInfo : NSObject
/**
@brief media title
*/
@property (nonatomic, copy) NSString* title;
/**
@brief media cover url
*/
@property (nonatomic, copy) NSString* coverURL;
/**
@brief media type
* video audio video|audio
*/
@property (nonatomic, copy) NSString* mediaType;
/**
@brief media status
*/
@property (nonatomic, copy) NSString* status;
/**
@brief media duration
* 单位: 毫秒
*/
/****
@brief media duration
* Unit: millisecond.
*/
@property (nonatomic, assign) int64_t duration;
/**
@brief 文件码率(vod 和多码率时值为0应该使用AVPTrackInfo中的trackBitrate)
*/
/****
@brief Retrievable bit rate (VOD and multi-bit rate values are 0; Should use trackBitrate in AVPTrackInfo)
*/
@property(nonatomic, assign) int64_t totalBitrate;
/**
@brief media transcodeMode
*转码类型取值FastTranscode上传完成即转码且转码完成才能播放NoTranscode上传完成不转码且立即能播放默认取值FastTranscode
*/
/****
@brief media transcodeMode
*Transcoding type. Valid values: FastTranscode and NoTranscode. FastTranscode: Transcode the content immediately after it is uploaded. Only transcoded content can be played. NoTranscode: Do not transcode the content after it is uploaded. Content can be played without transcoding. Default: FastTranscode.
*/
@property (nonatomic, copy) NSString* transcodeMode;
/**
@brief thumbnails in media info
*/
@property (nonatomic, strong) NSArray<AVPThumbnailInfo*>* thumbnails;
/**
@brief tracks in media info
*/
@property (nonatomic, strong) NSArray<AVPTrackInfo*>* tracks;
@end
#endif /* AVPMediaInfo_h */

View File

@@ -0,0 +1,24 @@
//
// Created by yiliang on 2023/6/20.
//
#ifndef AVPPRELOADCONFIG_H
#define AVPPRELOADCONFIG_H
#import <Foundation/Foundation.h>
OBJC_EXPORT
@interface AVPPreloadConfig : NSObject
/**
@brief 预加载时长 默认1000毫秒单位毫秒
*/
/****
@brief The maximum preload duration. Default: 1000 milliseconds, Unit: millisecond.
*/
@property (nonatomic, assign) int preloadDuration;
@end
#endif //SOURCE_AVPPRELOADCONFIG_H

View File

@@ -0,0 +1,406 @@
//
// AVPSource.h
// AliPlayerSDK
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#ifndef AVPSource_h
#define AVPSource_h
#import <Foundation/Foundation.h>
typedef int (^BitStreamReadCallbackBlock)(uint8_t *buffer, int size);
typedef long (^BitStreamSeekCallbackBlock)(long offset, int whence);
static const int SEEK_SIZE = 0x10000;
typedef NS_ENUM(NSUInteger, ENCRYPTION_TYPE) { ENCRYPTION_TYPE_NONE = 0, ENCRYPTION_TYPE_ALIVODENCRYPTION, ENCRYPTION_TYPE_FAIRPLAY };
OBJC_EXPORT
@interface AVPSource : NSObject
/**
@brief 封面地址
*/
/****
@brief The URL of the album cover.
*/
@property (nonatomic, copy) NSString* coverURL;
/**
@brief 视频标题
*/
/****
@brief The title of the video.
*/
@property (nonatomic, copy) NSString* title;
/**
@brief 期望播放的清晰度
*/
/****
@brief The preferred definition for playback.
*/
@property (nonatomic, copy) NSString* quality;
/**
@brief 是否强制使用此清晰度。如果强制,则在没有对应清晰度的情况下播放不了。
*/
/****
@brief Whether to force the player to play the media with the specified definition. If the media does not support the specified definition, then it cannot be played.
*/
@property (nonatomic, assign) BOOL forceQuality;
/**
@brief 设置点播服务器返回的码率清晰度类型。例如:"FD,LD,SD,HD,OD,2K,4K,SQ,HQ"。
* 注意:如果类型为"AUTO" 那么只会返回自适应码率流。
*/
@property (nonatomic, copy) NSString* definitions;
@end
OBJC_EXPORT
@interface AVPUrlSource : AVPSource
/**
@brief init AVPUrlSource with url
@param url video url address
*/
- (instancetype) urlWithString:(NSString*)url;
/**
@brief init AVPUrlSource with filepath
@param url file path
*/
- (instancetype) fileURLWithPath:(NSString*)url;
/**
@brief player url
*/
@property (nonatomic, copy) NSURL* playerUrl;
/**
@brief cache file path, app may cache the beginning of remote mp4 file to local path,
* set it to player to improve loading speed.
*/
@property (nonatomic, copy) NSString* cacheFile;
@property(nonatomic) uint64_t originSize;
@end
OBJC_EXPORT
@interface AVPBitStreamSource : AVPSource
@property(nonatomic, copy) BitStreamReadCallbackBlock mBitStreamReadCallbackBlock;
@property(nonatomic, copy) BitStreamSeekCallbackBlock mBitStreamSeekCallbackBlock;
@end
OBJC_EXPORT
@interface AVPVidStsSource : AVPSource
/**
@brief 用vid和sts来播放视频临时AccessKeyId、AccessKeySecret和SecurityToken开启RAM授权并通过STS授权系统提供的OpenAPI或SDK获取的AccessKeyId、AccessKeySecret和SecurityToken用于播放和下载请求参数明细https://help.aliyun.com/document_detail/28788.html?spm=5176.doc28787.6.706.2G5SLS
@param vid 视频播放的vid标识
@param accessKeyId 用户sts的accessKey ID
@param accessKeySecret 用户sts的accessKey secret
@param securityToken 用户sts的token信息
@param region 用户sts的region信息
*/
/****
@brief Play by VID and STS. Temporary AccessKey ID, AccessKey Secret, and token: Activate RAM, and use the API or SDK provided by STS to retrieve the AccessKey ID, AccessKey Secret, and token. Details about parameters in playback and download requests: https://help.aliyun.com/document_detail/28788.html?spm=5176.doc28787.6.706.2G5SLS
@param vid The VID of the video.
@param accessKeyId The AccessKey ID of the user.
@param accessKeySecret The AccessKey Secret of the user.
@param securityToken The token information of the user.
@param region The region information of the user.
*/
- (instancetype)initWithVid:(NSString *)vid
accessKeyId:(NSString *)accessKeyId
accessKeySecret:(NSString *)accessKeySecret
securityToken:(NSString *)securityToken
region:(NSString *)region;
- (instancetype)initWithVid:(NSString *)vid
accessKeyId:(NSString *)accessKeyId
accessKeySecret:(NSString *)accessKeySecret
securityToken:(NSString *)securityToken
region:(NSString *)region
playConfig:(NSString *)playConfig;
- (instancetype)initWithVid:(NSString *)vid
accessKeyId:(NSString *)accessKeyId
accessKeySecret:(NSString *)accessKeySecret
securityToken:(NSString *)securityToken
region:(NSString *)region
format:(NSString *)format
playConfig:(NSString *)playConfig;
/**
@brief vid
*/
@property (nonatomic, copy) NSString* vid;
/**
@brief accessKeyId
*/
@property (nonatomic, copy) NSString* accessKeyId;
/**
@brief accessKeySecret
*/
@property (nonatomic, copy) NSString* accessKeySecret;
/**
@brief securityToken
*/
@property (nonatomic, copy) NSString* securityToken;
/**
@brief region
*/
@property (nonatomic, copy) NSString* region;
/**
@brief playConfig
*/
@property (nonatomic, copy) NSString* playConfig;
/**
@brief format,default is nil, value is "mp4,mp3,flv,m3u8"
*/
@property (nonatomic, copy) NSString* format;
/**
@brief authTimeout
*/
@property (nonatomic, assign) long authTimeout;
/**
@brief resultType
*/
@property (nonatomic, copy) NSString* resultType;
/**
@brief reAuthInfo
*/
@property (nonatomic, copy) NSString* reAuthInfo;
/**
@brief streamType
*/
@property (nonatomic, copy) NSString* streamType;
/**
@brief outputType
*/
@property (nonatomic, copy) NSString* outputType;
@end
OBJC_EXPORT
@interface AVPVidAuthSource : AVPSource
- (instancetype)initWithVid:(NSString *)vid
playAuth:(NSString *)playAuth
region:(NSString *)region;
- (instancetype)initWithVid:(NSString *)vid
playAuth:(NSString *)playAuth
region:(NSString *)region
playConfig:(NSString *)playConfig;
- (instancetype)initWithVid:(NSString *)vid
playAuth:(NSString *)playAuth
region:(NSString *)region
format:(NSString *)format
playConfig:(NSString *)playConfig;
/**
@brief vid
*/
@property (nonatomic, copy) NSString* vid;
/**
@brief playAuth
*/
@property (nonatomic, copy) NSString* playAuth;
/**
@brief region
*/
@property (nonatomic, copy) NSString* region;
/**
@brief playConfig
*/
@property (nonatomic, copy) NSString* playConfig;
/**
@brief format,default is nil, value is "mp4,mp3,flv,m3u8"
*/
@property (nonatomic, copy) NSString* format;
/**
@brief authTimeout
*/
@property (nonatomic, assign) long authTimeout;
/**
@brief resultType
*/
@property (nonatomic, copy) NSString* resultType;
/**
@brief reAuthInfo
*/
@property (nonatomic, copy) NSString* reAuthInfo;
/**
@brief streamType
*/
@property (nonatomic, copy) NSString* streamType;
/**
@brief outputType
*/
@property (nonatomic, copy) NSString* outputType;
@end
OBJC_EXPORT
@interface AVPVidMpsSource : AVPSource
/**
@brief 用vid和MPS信息来播放视频视频转码服务用户使用播放方式。部分参数参考:https://help.aliyun.com/document_detail/53522.html?spm=5176.doc53534.2.5.mhSfOh
@param vid 视频播放的vid标识
@param accId 用户sts的accessKey ID
@param accSecret 用户sts的accessKey secret
@param stsToken 用户sts的token信息
@param authInfo 用户authInfo信息
@param region 用户region信息
@param playDomain 用户playDomain信息
@param mtsHlsUriToken 用户mtsHlsUriToken信息
*/
/****
@brief Play by VID and MPS. This playback method is used by video transcoding service users. Reference for some of the parameters: https://help.aliyun.com/document_detail/53522.html?spm=5176.doc53534.2.5.mhSfOh
@param vid The VID of the video.
@param accId The AccessKey ID of the user.
@param accSecret The AccessKey Secret of the user.
@param stsToken The token information of the user.
@param authInfo The authInfo of the user.
@param region The region information of the user.
@param playDomain The playDomain information of the user.
@param mtsHlsUriToken The mtsHlsUriToken information of the user.
*/
- (instancetype)initWithVid:(NSString*)vid
accId:(NSString *)accId
accSecret:(NSString*)accSecret
stsToken:(NSString*)stsToken
authInfo:(NSString*)authInfo
region:(NSString*)region
playDomain:(NSString*)playDomain
mtsHlsUriToken:(NSString*)mtsHlsUriToken;
/**
@brief vid
*/
@property (nonatomic, copy) NSString* vid;
/**
@brief accId
*/
@property (nonatomic, copy) NSString* accId;
/**
@brief accSecret
*/
@property (nonatomic, copy) NSString* accSecret;
/**
@brief stsToken
*/
@property (nonatomic, copy) NSString* stsToken;
/**
@brief authInfo
*/
@property (nonatomic, copy) NSString* authInfo;
/**
@brief region
*/
@property (nonatomic, copy) NSString* region;
/**
@brief playDomain
*/
@property (nonatomic, copy) NSString* playDomain;
/**
@brief mtsHlsUriToken
*/
@property (nonatomic, copy) NSString* mtsHlsUriToken;
@end
OBJC_EXPORT
@interface AVPLiveStsSource : AVPSource
- (instancetype)initWithUrl:(NSString *)url
accessKeyId:(NSString *)accessKeyId
accessKeySecret:(NSString *)accessKeySecret
securityToken:(NSString *)securityToken
region:(NSString *)region
domain:(NSString *)domain
app:(NSString *)app
stream:(NSString *)stream
encryptionType:(ENCRYPTION_TYPE)encryptionType;
/**
@brief url
*/
@property (nonatomic, copy) NSString* url;
/**
@brief accessKeyId
*/
@property (nonatomic, copy) NSString* accessKeyId;
/**
@brief accessKeySecret
*/
@property (nonatomic, copy) NSString* accessKeySecret;
/**
@brief securityToken
*/
@property (nonatomic, copy) NSString* securityToken;
/**
@brief region
*/
@property (nonatomic, copy) NSString* region;
/**
@brief domain
*/
@property (nonatomic, copy) NSString* domain;
/**
@brief app
*/
@property (nonatomic, copy) NSString* app;
/**
@brief stream
*/
@property (nonatomic, copy) NSString* stream;
/**
@brief encryptionType
*/
@property(assign) ENCRYPTION_TYPE encryptionType;
@end
#endif /* AVPSource_h */

View File

@@ -0,0 +1,374 @@
//
// AliListPlayer.h
// AliListPlayer
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AliPlayer.h"
#import "AVPPreloadConfig.h"
OBJC_EXPORT
@interface AliListPlayer : AliPlayer
/**
@brief 初始化播放列表
*/
/****
@brief Initialize the playlist.
*/
- (instancetype)init;
/**
@brief 初始化播放器
@param traceID 用于跟踪debug信息
*/
/****
@brief Initialize the player.
@param traceID The trace ID for debugging.
*/
- (instancetype)init:(NSString*)traceID;
- (void)stop;
- (void)destroy;
/**
@brief 添加资源到播放列表中
@param vid vid的播放方式
@param uid 该资源的uid代表在列表中的唯一标识
*/
/****
@brief Add a resource to the playlist.
@param vid Specify a resource by VID.
@param uid The UID of the resource, which uniquely identifies a resource.
*/
- (void) addVidSource:(NSString*)vid uid:(NSString*)uid;
/**
@brief 添加资源到播放列表中
@param url url的播放方式
@param uid 该资源的uid代表在列表中的唯一标识
*/
/****
@brief Add a resource to the playlist.
@param url Specify a resource by URL.
@param uid The UID of the resource, which uniquely identifies a resource.
*/
- (void) addUrlSource:(NSString*)url uid:(NSString*)uid;
/**
@brief 添加资源到播放列表中
@param url url的播放方式
@param uid 该资源的uid代表在列表中的唯一标识
@param config 预加载配置
*/
/****
@brief Add a resource to the playlist.
@param url Specify a resource by URL.
@param uid The UID of the resource, which uniquely identifies a resource.
@param config preload config
*/
- (void) addUrlSource:(NSString*)urlSource uid:(NSString*)uid config:(AVPPreloadConfig*)config;
/**
* 更新预加载配置
* @param config 预加载配置
*/
/****
* update preload config
* @param config preload config
*/
- (void) updatePreloadConfiguid:(NSString*)uid config:(AVPPreloadConfig*)config;
/**
* 设置预加载场景。
* @param type 场景类型
*/
/****
* Set preload scene.
* @param type scene type
*/
- (void) setScene:(AVPSceneType)type;
/**
* 启用预加载策略。
* @param type 策略类型
* @param enable 是否启用
*/
/****
* enable preload strategy.
* @param type strategy type
* @param enable enable strategy
*/
- (void) enableStrategy:(AVPStrategyType)type enable:(bool)enable;
/**
* 设置策略参数。
* @param type 策略类型
* @param strategyParam 策略参数格式为json字符串
* 支持参数algorithm, offset, scale
* 配置参数举例:
* 动态预加载时长递减策略
* 默认配置
* {
* "algorithm":"sub",
* "offset":"500"
* }
* 转换成字符串为 "{\"algorithm\": \"div\",\"scale\": \"0.75\"}"
* 或者
* {
* "algorithm":"div",
* "scale":"0.75"
* }
*/
/****
* set strategy parameter.
* @param type strategy type
* @param strategyParam strategy parameter, type is json string
* support param: algorithm, offset, scale
* for example:
* dynamic preload duration decrease strategy
* default strategy
* {
* "algorithm":"sub",
* "offset":"500"
* }
* transfer to string: "{\"algorithm\": \"div\",\"scale\": \"0.75\"}"
* or
* {
* "algorithm":"div",
* "scale":"0.75"
* }
*/
- (void) setStrategyParam:(AVPStrategyType)type strategyParam:(NSString*)strategyParam;
/**
* 更新uid相关的预加载配置
* @param uid 每个url都是不一样的uid
* @param config 预加载配置
*/
/****
* update preload config related to uid
* @param uid each URL is a unique UID
* @param config preload config
*/
- (void) updatePreloadConfig:(AVPPreloadConfig*)config;
/**
* 设置预加载数量
* @param prevCount 之前的预加载数量
* @param nextCount 后面的预加载数量
*/
/****
* update set preload count
* @param prevCount previous preload count
* @param nextCount next preload count
*/
- (void) setPreloadCount:(int)prevCount nextCount:(int)nextCount;
/**
@brief 从播放列表中删除指定资源
@param uid 该资源的uid代表在列表中的唯一标识
*/
/****
@brief Remove a resource from the playlist.
@param uid The UID of the resource, which uniquely identifies a resource.
*/
- (void) removeSource:(NSString*)uid;
/**
@brief 清除播放列表
*/
/****
@brief Clear the playlist.
*/
- (void) clear;
/**
@brief 获取当前播放资源的uid
*/
/****
@brief Query the UID of the resource that is being played.
*/
- (NSString*) currentUid;
/**
@brief 获取预渲染的播放器实例。listPlayer在播放当前视频时会去预渲染下一个视频用户可以用该预渲染的实例去提前播放下一个视频
*/
- (AliPlayer*) getPreRenderPlayer;
/**
@brief 获取当前的播放器实例。
*/
- (AliPlayer*) getCurrentPlayer;
/**
@brief 当前位置移动到下一个进行准备播放,url播放方式
*/
/****
@brief Seek to the next resource and prepare for playback. Only playback by URL is supported.
*/
- (BOOL) moveToNext;
/**
@brief 当前位置移动到下一个进行准备播放,url播放方式.该接口只在使用了预渲染的playergetPreRenderPlayer返回的player去播放的时候去调用listPlayer内部不再去播放
*/
/****
@brief Seek to the next resource and prepare for playback. Only playback by URL is supported.
*/
- (BOOL) moveToNextWithPrerendered;
/**
@brief 当前位置移动到上一个进行准备播放,url播放方式
*/
/****
@brief Seek to the previous resource and prepare for playback. Only playback by URL is supported.
*/
- (BOOL) moveToPre;
/**
@brief 移动到指定位置开始准备播放,url播放方式
@param uid 指定资源的uid代表在列表中的唯一标识
*/
/****
@brief Seek to the specified position and prepare for playback. Only playback by URL is supported.
@param uid The UID of the specified resource, which uniquely identifies a resource.
*/
- (BOOL) moveTo:(NSString*)uid;
/**
@brief 当前位置移动到下一个进行准备播放sts播放方式需要更新sts信息
@param accId vid sts播放方式的accessKeyID
@param accKey vid sts播放方式的accessKeySecret
@param token vid sts播放方式的securtiToken
@param region vid sts播放方式的region 默认cn-shanghai
*/
/****
@brief Seek to the next resource and prepare for playback. Only playback by STS is supported. You must update the STS information.
@param accId vid The AccessKey ID.
@param accKey vid The AccessKey Secret.
@param token vid The STS token.
@param region vid The specified region. Default: cn-shanghai.
*/
- (BOOL) moveToNext:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region;
/**
@brief 当前位置移动到下一个进行准备播放playauth播放方式需要更新playauth信息
@param playAuth vid playauth播放方式的playAuth
*/
/****
@brief Seek to the next resource and prepare for playback. Only playback by playauth is supported. You must update the playauth information.
@param playAuth vid The playAuth ID.
*/
- (BOOL) moveToNext:(NSString*)playAuth;
/**
@brief 当前位置移动到下一个进行准备播放sts播放方式需要更新sts信息.该接口只在使用了预渲染的playergetPreRenderPlayer返回的player去播放的时候去调用listPlayer内部不再去播放
@param accId vid sts播放方式的accessKeyID
@param accKey vid sts播放方式的accessKeySecret
@param token vid sts播放方式的securtiToken
@param region vid sts播放方式的region 默认cn-shanghai
@param preRendered 是否使用了预渲染的player去播放如果为true则listPlayer内部不再去播放
*/
/****
@brief Seek to the next resource and prepare for playback. Only playback by STS is supported. You must update the STS information.
@param accId vid The AccessKey ID.
@param accKey vid The AccessKey Secret.
@param token vid The STS token.
@param region vid The specified region. Default: cn-shanghai.
*/
- (BOOL) moveToNextWithPrerendered:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region;
/**
@brief 当前位置移动到下一个进行准备播放playauth播放方式需要更新playauth信息.该接口只在使用了预渲染的playergetPreRenderPlayer返回的player去播放的时候去调用listPlayer内部不再去播放
@param playAuth vid playauth播放方式的playAuth
*/
/****
@brief Seek to the next resource and prepare for playback. Only playback by playauth is supported. You must update the playauth information.
@param playAuth vid The playAuth ID.
*/
- (BOOL) moveToNextWithPrerendered:(NSString*)playAuth;
/**
@brief 当前位置移动到上一个进行准备播放sts播放方式需要更新sts信息
@param accId vid sts播放方式的accessKeyID
@param accKey vid sts播放方式的accessKeySecret
@param token vid sts播放方式的securtiToken
@param region vid sts播放方式的region 默认cn-shanghai
*/
/****
@brief Seek to the previous resource and prepare for playback. Only playback by STS is supported. You must update the STS information.
@param accId vid The AccessKey ID.
@param accKey vid The AccessKey Secret.
@param token vid The STS token.
@param region vid The specified region. Default: cn-shanghai.
*/
- (BOOL) moveToPre:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region;
/**
@brief 当前位置移动到上一个进行准备播放playauth播放方式需要更新playauth信息
@param playAuth vid playauth播放方式的playAuth
*/
/****
@brief Seek to the previous resource and prepare for playback. Only playback by playauth is supported. You must update the playauth information.
@param playAuth vid The playAuth ID.
*/
- (BOOL) moveToPre:(NSString*)playAuth;
/**
@brief 移动到指定位置开始准备播放sts播放方式需要更新sts信息
@param uid 指定资源的uid代表在列表中的唯一标识
@param accId vid sts播放方式的accessKeyID
@param accKey vid sts播放方式的accessKeySecret
@param token vid sts播放方式的securtiToken
@param region vid sts播放方式的region 默认cn-shanghai
*/
/****
@brief Seek to the specified resource and prepare for playback. Only playback by STS is supported. You must update the STS information.
@param uid The UID of the specified resource, which uniquely identifies a resource.
@param accId vid The AccessKey ID.
@param accKey vid The AccessKey Secret.
@param token vid The STS token.
@param region vid The specified region. Default: cn-shanghai.
*/
- (BOOL) moveTo:(NSString*)uid accId:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region;
/**
@brief 移动到指定位置开始准备播放playauth播放方式需要更新playauth信息
@param uid 指定资源的uid代表在列表中的唯一标识
@param playAuth vid playauth播放方式的playAuth
*/
/****
@brief Seek to the specified resource and prepare for playback. Only playback by playauth is supported. You must update the playauth information.
@param uid The UID of the specified resource, which uniquely identifies a resource.
@param playAuth vid The playAuth ID.
*/
- (BOOL) moveTo:(NSString*)uid playAuth:(NSString*)playAuth;
/**
@brief 设置最大的预缓存的内存大小默认100M最小20M
*/
/****
@brief Set the maximum preloading cache size. Default: 100 MB. Minimum: 20 MB.
*/
@property (nonatomic, assign) int maxPreloadMemorySizeMB;
/**
@brief 获取/设置预加载的个数当前位置的前preloadCount和后preloadCount默认preloadCount = 2
*/
/****
@brief Query or set the number of preloaded resources. The number of resources before preloading and the number of resources after preloading are returned. Default: 2.
*/
@property (nonatomic, assign) int preloadCount;
/**
@brief 获取/设置列表播放的sts播放方式指定默认的清晰度如"LD、HD"等moveTo之前调用一旦预加载后不能更改
*/
/****
@brief Query or set the definition for playback by STS, such as LD or HD. Call this method before moveTo. After the resources are preloaded, you cannot change the definition.
*/
@property (nonatomic, copy) NSString* stsPreloadDefinition;
@property (nonatomic, copy) NSString* playAuthPreloadDefinition;
@end

View File

@@ -0,0 +1,102 @@
#import "AVPDef.h"
#import <Foundation/Foundation.h>
@protocol AliMediaLoaderStatusDelegate <NSObject>
@optional
/**
@brief 错误回调
@param url 加载url
@param code 错误码
@param msg 错误描述
*/
/****
@brief Error callback
@param url the load URL
@param code Error code
@param msg Error description
*/
- (void)onError:(NSString *)url code:(int64_t)code msg:(NSString *)msg;
/**
@brief 完成回调
@param url 加载url
*/
/****
@brief Completed callback
@param URL the load URL
*/
- (void)onCompleted:(NSString *)url;
/**
@brief 取消回调
@param url 加载url
*/
/****
@brief the Canceled callback
@param URL the load URL
*/
- (void)onCanceled:(NSString *)url;
@end
OBJC_EXPORT
@interface AliMediaLoader : NSObject
+ (instancetype)shareInstance;
/**
@brief 开始加载文件。异步加载。可以同时加载多个。
@param url 视频文件地址
@param duration 加载的时长大小.单位:毫秒
*/
/****
@brief Start load. Asynchronous loading. You can load more than one at a time.
@param url Video file url
@param duration Load duration. Unit: millisecond
*/
- (void)load:(NSString *)url duration:(int64_t)duration;
/**
@brief 取消加载。注意:不会删除已经下载的文件。
@param url 视频文件地址 。为nil或者空则取消全部。
*/
/****
@brief Cancel load. Note: Downloaded files will not be deleted.
@param url Video file url. Nil or null, cancel all.
*/
- (void)cancel:(NSString *)url;
/**
@brief 暂停加载。
@param url 视频文件地址。 为nil或者空则暂停全部。
*/
/****
@brief pause load.
@param url Video file url. Nil or null, pause all.
*/
- (void)pause:(NSString *)url;
/**
@brief 恢复加载。
@param url 视频文件地址。 为nil或者空则恢复全部。
*/
/****
@brief Resume load.
@param url Video file url. Nil or null, resume all.
*/
- (void)resume:(NSString *)url;
/**
@brief 设置状态代理参考AliMediaLoaderStatusDelegate
@see AliMediaLoaderStatusDelegate
*/
/****
@brief, set the status Delegate
@see AliMediaLoaderStatusDelegate
*/
- (void)setAliMediaLoaderStatusDelegate:(id<AliMediaLoaderStatusDelegate>)delegate;
@end

View File

@@ -0,0 +1,936 @@
//
// AliPlayer.h
// AliPlayer
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#import "AVPCacheConfig.h"
#import "AVPConfig.h"
#import "AVPDef.h"
#import "AVPDelegate.h"
#import "AVPFilterConfig.h"
#import "AVPMediaInfo.h"
#import "AVPSource.h"
#import <Foundation/Foundation.h>
@protocol CicadaAudioSessionDelegate;
@protocol CicadaRenderDelegate;
@protocol CicadaRenderingDelegate;
@protocol AliPlayerPictureInPictureDelegate;
@class AVPFilterConfig;
@class AVPFilterOptions;
OBJC_EXPORT
@interface AliPlayer : NSObject
/**
@brief 初始化播放器
*/
/****
@brief Initialize the player.
*/
- (instancetype)init;
/**
@brief 初始化播放器
@param traceID 便于跟踪日志,设为"DisableAnalytics"可关闭日志分析系统(不推荐)。
*/
/****
@brief Initialize the player.
@param traceID A trace ID for debugging. Set as "DisableAnalytics" to disable report analytics data to server(not recommended).
*/
- (instancetype)init:(NSString*)traceID;
- (void *)getPlayer;
/**
@brief 使用url方式来播放视频
@param source AVPUrlSource的输入类型
@see AVPUrlSource
*/
/****
@brief Play by URL.
@param source AVPUrlSource type.
@see AVPUrlSource
*/
- (void)setUrlSource:(AVPUrlSource*)source;
/**
@brief 使用bitstream方式来播放视频
@param source AVPBitStreamSource的输入类型
@see AVPBitStreamSource
*/
/****
@brief Play by bit stream.
@param source AVPBitStreamSource type.
@see AVPBitStreamSource
*/
- (void)setBitStreamSource:(AVPBitStreamSource *)source;
/**
@brief 用vid和sts来播放视频sts可参考https://help.aliyun.com/document_detail/28756.html?spm=a2c4g.11186623.4.4.6f554c07q7B7aS
@param source AVPVidStsSource的输入类型
@see AVPVidStsSource
*/
/****
@brief Play by VID and STS. For STS, see https://help.aliyun.com/document_detail/28756.html?spm=a2c4g.11186623.4.4.6f554c07q7B7aS
@param source AVPVidStsSource type.
@see AVPVidStsSource
*/
- (void)setStsSource:(AVPVidStsSource*)source;
/**
@brief 用vid和MPS信息来播放视频。可参考https://help.aliyun.com/document_detail/53522.html?spm=5176.doc53534.2.5.mhSfOh
@param source AVPVidMpsSource的输入类型
@see AVPVidMpsSource
*/
/****
@brief Play by VID and MPS. See https://help.aliyun.com/document_detail/53522.html?spm=5176.doc53534.2.5.mhSfOh
@param source AVPVidMpsSource type.
@see AVPVidMpsSource
*/
- (void)setMpsSource:(AVPVidMpsSource*)source;
/**
@brief 使用vid+playauth方式播放。可参考https://help.aliyun.com/document_detail/57294.html
@param source AVPVidAuthSource的输入类型
@see AVPVidAuthSource
*/
/****
@brief Play by VID and playauth. See https://help.aliyun.com/document_detail/57294.html
@param source AVPVidAuthSource type.
@see AVPVidAuthSource
*/
- (void)setAuthSource:(AVPVidAuthSource*)source;
/**
@brief 使用LiveSts 方式播放直播流
@param source AVPLiveStsSource的输入类型
*/
/****
@brief Play by 使用LiveSts.
@param source AVPLiveStsSource type.
*/
- (void)setLiveStsSource:(AVPLiveStsSource*)source;
/**
@brief 更新LiveSts信息
*/
/****
@brief update liveSts info.
*/
- (void)updateLiveStsInfo:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region;
/**
@brief 播放准备,异步
*/
/****
@brief Prepare for playback. Asynchronous callback.
*/
-(void)prepare;
/**
@brief 开始播放
*/
/****
@brief Start playing.
*/
-(void)start;
/**
@brief 暂停播放
*/
/****
@brief Pause.
*/
-(void)pause;
/**
@brief 刷新view例如view size变化时。
*/
/****
@brief Refresh the view in certain situations, for example, when the size of the view changes.
*/
- (void)redraw DEPRECATED_MSG_ATTRIBUTE("will not take effect");
/**
@brief 清空画面。
*/
/****
@brief Clear screen.
*/
- (void)clearScreen;
/**
@brief 重置播放
*/
/****
@brief Reset.
*/
-(void)reset DEPRECATED_ATTRIBUTE;
/**
@brief 停止播放
*/
/****
@brief Stop.
*/
-(void)stop;
/**
@brief 销毁播放器
*/
/****
@brief Delete the player.
*/
-(void)destroy;
/**
@brief 跳转到指定的播放位置
@param time 新的播放位置,单位毫秒
@param seekMode seek模式
@see AVPSeekMode
*/
/****
@brief Seek to a specified position.
@param time The specified position that the player will seek to, Unit: millisecond.
@param seekMode Seek mode.
@see AVPSeekMode
*/
-(void)seekToTime:(int64_t)time seekMode:(AVPSeekMode)seekMode;
/**
* 设置精准seek的最大间隔。
* @param delta 间隔时间,单位毫秒
*/
/****
* set the maximum interval of precision seek.
* @param delta interval in milliseconds
*/
-(void)setMaxAccurateSeekDelta:(int)delta;
/**
@brief 截图 AVPImage: mac平台返回NSImageiOS平台返回UIImage
*/
/****
@brief Snapshot. AVPImage: For a Mac platform, NSImage is returned. For an iOS platform, UIImage is returned.
*/
-(void) snapShot;
/**
@brief 根据trackIndex切换清晰度
@param trackIndex 选择清晰度的indexSELECT_AVPTRACK_TYPE_VIDEO_AUTO代表自适应码率
*/
/****
@brief Switch definition according to the specified track index.
@param trackIndex Specify a definition index. SELECT_AVPTRACK_TYPE_VIDEO_AUTO: auto bitrate adjustment.
*/
-(void)selectTrack:(int)trackIndex;
/**
@brief 根据trackIndex切换清晰度
@param trackIndex 选择清晰度的indexSELECT_AVPTRACK_TYPE_VIDEO_AUTO代表自适应码率
@param accurate 是否精准跳转。
*/
/****
@brief Switch definition according to the specified track index.
@param trackIndex Specify a definition index. SELECT_AVPTRACK_TYPE_VIDEO_AUTO: auto bitrate adjustment.
@param accurate Use accurate seeking to select track。
*/
-(void)selectTrack:(int)trackIndex accurate:(BOOL)accurate;
/**
@brief 获取媒体信息包括track信息
*/
/****
@brief Query media information, including track information.
*/
-(AVPMediaInfo*) getMediaInfo;
/**
@brief 获取当前播放track
@param type track类型
@see AVPTrackType
*/
/****
@brief Query the track that is being played.
@param type Track type.
@see AVPTrackType
*/
-(AVPTrackInfo*) getCurrentTrack:(AVPTrackType)type;
/**
@brief 设置缩略图URL
@param URL 缩略图URL
*/
/****
@brief Specify a thumbnail image URL.
@param URL The specified thumbnail image URL.
*/
-(void) setThumbnailUrl:(NSString *)URL;
/**
@brief 获取指定位置的缩略图
@param positionMs 代表在哪个指定位置的缩略图
*/
/****
@brief Retrieve the thumbnail image at the specified position.
@param positionMs The specified position.
*/
-(void)getThumbnail:(int64_t)positionMs;
/**
@brief 用于跟踪debug信息
@param traceID 指定和其他客户端连接可跟踪的id
*/
/****
@brief Set a trace ID for debugging.
@param traceID The specified client connection trace ID.
*/
- (void) setTraceID:(NSString*)traceID;
/**
@brief 设置转换播放的url的回调函数一般用于p2p中的url地址转换
@param callback 回调函数指针
*/
/****
@brief Set a URL conversion callback. URL conversion is typically used in P2P broadcasting.
@param callback The function pointer of the callback.
*/
- (void) setPlayUrlConvertCallback:(PlayURLConverCallback)callback;
/**
@brief 播放器设置
@param config AVPConfig类型
@see AVPConfig
*/
/****
@brief Modify player configuration.
@param config AVPConfig type.
@see AVPConfig
*/
-(void) setConfig:(AVPConfig*)config;
/**
@brief 播放器降级设置
@param source 降级url
@param config 降级配置
*/
/****
@brief Modify player configuration.
@param source downgrade url
@param config downgrade config.
@see AVPConfig
*/
-(void) enableDowngrade:(AVPUrlSource*)source config:(AVPConfig*)config;
/**
@brief 获取播放器设置
@see AVPConfig
*/
/****
@brief Query player configuration.
@see AVPConfig
*/
-(AVPConfig*) getConfig;
/**
@brief 设置缓存配置
@param AVPCacheConfig 缓存配置。{@link AVPCacheConfig}。
@return 设置成功返回YES
*/
/****
@brief Modify cache configuration.
@param AVPCacheConfig Cache configuration. {@link AVPCacheConfig}.
@return If the cache configuration is modified, YES is returned.
*/
-(BOOL) setCacheConfig:(AVPCacheConfig *)cacheConfig;
/**
@brief 设置滤镜配置。在prepare之前调用此方法。如果想更新调用updateFilterConfig()
@param filterConfig
*/
/****
@brief Set filter config. call this before prepare. If want update filter config, call updateFilterConfig()
@param filterConfig
*/
- (void)setFilterConfig:(AVPFilterConfig *)filterConfig;
/**
@brief更新滤镜配置
@param target
@param options
*/
/****
@brief upadate filter config.
@param target
@param options
*/
- (void)updateFilterConfig:(NSString *)target options:(AVPFilterOptions *)options;
/**
@brief 开启关闭滤镜.
@param target 如果为空,则对所有滤镜生效
@param invalid true: 开启; false: 关闭
*/
/****
@brief disable/enable filter.
@param target if empty , disable all filters.
@param invalid true: enable(default); false: disable
*/
- (void)setFilterInvalid:(NSString *)target invalid:(BOOL)invalid;
/**
@brief 根据url获取缓存的文件名。如果有自定义的规则请实现delegate {@link onGetCacheNameByURL}。
@brief 如果没有实现delegate将会采用默认逻辑生成文件名。
@param URL URL
* @return 最终缓存的文件名(不包括后缀。缓存文件的后缀名统一为.alv
*/
/****
@brief Query the name of the cached file with the specified URL. If a custom rule is set, delegate {@link onGetCacheNameByURL}.
@brief If the delegation failed, the default logic is used to generate the file name.
@param URL The URL of the cached file.
* @return The name of the cached file. The file extension is not included. All files use the .alv extension.
*/
-(NSString *) getCacheFilePath:(NSString *)URL;
/**
@brief 根据url获取缓存的文件名。如果有自定义的规则请实现delegate {@link onCacheNameByVidCallback}。
@brief 如果没有实现delegate将会采用默认逻辑生成文件名。
@param vid 视频id
@param format 视频格式
@param definition 视频清晰度
@return 最终缓存的文件名(不包括后缀。缓存文件的后缀名统一为.alv
*/
/****
@brief Query the name of the cached file with the specified URL. If a custom rule is set, delegate {@link onCacheNameByVidCallback}.
@brief If the delegation failed, the default logic is used to generate the file name.
@param vid The VID of the video.
@param format The format of the video.
@param definition The definition of the video.
@return The name of the cached file. The file extension is not included. All files use the .alv extension.
*/
-(NSString *) getCacheFilePath:(NSString *)vid format:(NSString *)format definition:(NSString *)definition;
/**
@brief 根据url获取缓存的文件名。如果有自定义的规则请实现delegate {@link onCacheNameByVidCallback}。
@brief 如果没有实现delegate将会采用默认逻辑生成文件名。
@param vid 视频id
@param format 视频格式
@param definition 视频清晰度
@param previewTime 试看时长
@return 最终缓存的文件名(不包括后缀。缓存文件的后缀名统一为.alv
*/
/****
@brief Query the name of the cached file with the specified URL. If a custom rule is set, delegate {@link onCacheNameByVidCallback}.
@brief If the delegation failed, the default logic is used to generate the file name.
@param vid The VID of the video.
@param format The format of the video.
@param definition The definition of the video.
@param previewTime The preview duration of the video.
@return The name of the cached file. The file extension is not included. All files use the .alv extension.
*/
-(NSString *) getCacheFilePath:(NSString *)vid format:(NSString *)format definition:(NSString *)definition previewTime:(int)previewTime;
/**
@brief 添加外挂字幕。
@param URL 字幕地址
*/
/****
@brief Add external subtitles
@param URL subtitle address
*/
-(void) addExtSubtitle:(NSString *)URL;
/**
@brief 选择外挂字幕
@param trackIndex 字幕索引
@param enable true选择false关闭
*/
/****
@brief Select external subtitles
@param trackIndex caption index
@param enable true: select, false: close
*/
-(void) selectExtSubtitle:(int)trackIndex enable:(BOOL)enable;
/**
* 设置某路流相对于主时钟的延时时间默认是0, 目前只支持外挂字幕
* @param index 流的索引
* @param time 延时,单位毫秒
*/
/****
* set the delay time of the stream
* @param index steam index
* @param time ms
*/
- (void)setStreamDelayTime:(int)index time:(int)time;
/**
@brief 重新加载。比如网络超时时,可以重新加载。
*/
/****
@brief Reload resources. You can reload resources when the network connection times out.
*/
-(void) reload;
/**
@brief 根据key获取相应的信息。
@param key 关键字枚举值
* @return 相应信息(找不到相应信息返回空字符串)。
*/
/****
@brief Get information by key.
@param key The enum of key
* @return corresponding information, return "" if doesn't exist.
*/
-(NSString *) getPropertyString:(AVPPropertyKey)key;
/**
@brief 设置多码率时默认播放的码率。将会选择与之最接近的一路流播放。
@param bandWidth 播放的码率。
*/
/****
@brief Set the default playback bitrate for multi-bit rate. The nearest stream will be selected.
@param bandWidth bit rate .
*/
-(void) setDefaultBandWidth:(int)bandWidth;
#if TARGET_OS_IPHONE
/**
@brief 设置视频的背景色
@param color the color
*/
/****
@brief Set video background color
@param color the color
*/
-(void) setVideoBackgroundColor:(UIColor *)color;
/**
@brief 设置视频快速启动
@param enable true开启false关闭
*/
/****
@brief Set video fast start
@param enable trueenablefalse: disable
*/
-(void) setFastStart:(BOOL)enable;
/**
@brief 设置ip解析类型
@param type ip解析类型
*/
/****
@brief Set ip resolve type
@param type ip resolve type
*/
-(void) setIPResolveType:(AVPIpResolveType)type;
#endif
/**
@brief 设置代理 参考AVPEventReportParamsDelegate
@see AVPEventReportParamsDelegate
*/
/****
@brief Set a proxy. See AVPEventReportParamsDelegate.
@see AVPEventReportParamsDelegate
*/
-(void) setEventReportParamsDelegate:(id<AVPEventReportParamsDelegate>)delegate;
/**
* @brief 为画中画功能设置代理
*
* @param delegate 画中画代理
*/
/****
* @brief set delegate for picture in picture
*
* @param delegate pictureInPicture delegate
*/
-(void) setPictureinPictureDelegate:(id<AliPlayerPictureInPictureDelegate>)delegate;
/**
* @brief 获取播放器的参数
*
* @param key 参数值
* @return 相关信息
*/
/****
* @brief Get player information
*
* @param key The key
* @return The information
*/
-(NSString *) getOption:(AVPOption)key;
/**
@brief 向播放器的组件发送命令。
@param content 命令内容。
@return 命令执行结果, < 0 失败。
*/
/****
@brief Send command to component
@param content command content
@return < 0 on Error
*/
- (int)invokeComponent:(NSString *)content;
/**
@brief 获取SDK版本号信息
*/
/****
@brief Query the SDK version.
*/
+ (NSString *)getSDKVersion;
/**
@brief 获取设备UUID
*/
/****
@brief Query device UUID.
*/
+ (NSString *)getDeviceUUID;
/**
@brief 返回某项功能是否支持
@param type 是否支持的功能的类型。 参考SupportFeatureType。
*/
/****
@brief judge whether support the type of feature.
@param type The type of the support feature. See SupportFeatureType.
*/
+ (BOOL)isFeatureSupport:(SupportFeatureType)type;
/**
@brief 初始化播放器组件。这些组件是可裁剪的。App可删除相应动态库去掉初始化组件代码实现裁剪。
*/
/****
@brief Initialize player components. These components are optional. You can remove these components by deleting the dynamic libraries and code of the components on your app.
*/
+ (void)initPlayerComponent:(NSString *)functionName function:(void *)function;
/**
@brief 设置是否静音支持KVO
*/
/****
@brief Mute or unmute the player. KVO is supported.
*/
@property(nonatomic, getter=isMuted) BOOL muted;
/**
@brief 播放速率0.5-2.0之间1为正常播放支持KVO
*/
/****
@brief Set the playback speed. Valid values: 0.5 to 2.0. Value 1 indicates normal speed. KVO is supported.
*/
@property(nonatomic) float rate;
/**
@brief 是否开启硬件解码支持KVO
*/
/****
@brief Enable or disable hardware decoding. KVO is supported.
*/
@property(nonatomic) BOOL enableHardwareDecoder;
/**
@brief 设置是否循环播放支持KVO
*/
/****
@brief Enable or disable loop playback. KVO is supported.
*/
@property(nonatomic, getter=isLoop) BOOL loop;
/**
@brief 设置是否自动播放支持KVO
*/
/****
@brief Enable or disable autoplay. KVO is supported.
*/
@property(nonatomic, getter=isAutoPlay) BOOL autoPlay;
/**
@brief 渲染镜像模式支持KVO
@see AVPMirrorMode
*/
/****
@brief Set a mirroring mode. KVO is supported.
@see AVPMirrorMode
*/
@property(nonatomic) AVPMirrorMode mirrorMode;
/**
@brief 渲染旋转模式支持KVO
@see AVPRotateMode
*/
/****
@brief Set a rotate mode. KVO is supported.
@see AVPRotateMode
*/
@property(nonatomic) AVPRotateMode rotateMode;
/**
@brief 渲染填充模式支持KVO
@see AVPScalingMode
*/
/****
@brief Set a zoom mode. KVO is supported.
@see AVPScalingMode
*/
@property(nonatomic) AVPScalingMode scalingMode;
/**
@brief 设置输出声道若输入源是双声道则支持切换为左声道、右声道若输入源是单声道则设置无效。该设置会同时影响音频渲染及PCM数据回调
@see AVPOutputAudioChannel
*/
/****
@brief Set the output audio channel, if input source is stereo, support select to left or right channel and if intput source is mono, this api can't take effect. This api can take effect on both audio render and audio pcm data callback.
@see AVPOutputAudioChannel
*/
@property(nonatomic) AVPOutputAudioChannel outputAudioChannel;
/**
@brief 设置播放器的视图playerView
* AVPView: mac下为NSOpenGLViewiOS下为UIView
*/
/****
@brief Set a player view (playerView).
* AVPView: Mac platform: NSOpenGLView. iOS platform: UIView.
*/
@property(nonatomic, strong) AVPView* playerView;
/**
@brief 获取视频的宽度支持KVO
*/
/****
@brief Query the width of the video. KVO is supported.
*/
@property (nonatomic, readonly) int width;
/**
@brief 获取视频的高度支持KVO
*/
/****
@brief Query the height of the video. KVO is supported.
*/
@property (nonatomic, readonly) int height;
/**
@brief 获取视频的旋转角度从metadata中获取出来支持KVO
*/
/****
@brief Query the rotate angle of the video, which is retrieved from the video metadata. KVO is supported.
*/
@property (nonatomic, readonly) int rotation;
/**
@brief 获取/设置播放器的音量非系统音量支持KVO范围0.0~2.0当音量大于1.0时,可能出现噪音,不推荐使用。
*/
/****
@brief Query or set the volume of the player(Not system volume). KVO is supported. The range is 0.0~2.0it maybe lead to noise if set volume more then 1.0, not recommended.
*/
@property (nonatomic, assign) float volume;
/**
@brief 获取视频的长度支持KVO
*/
/****
@brief Query the length of the video. KVO is supported.
*/
@property (nonatomic, readonly) int64_t duration;
/**
@brief 获取当前播放位置支持KVO
*/
/****
@brief Query the current playback position. KVO is supported.
*/
@property (nonatomic, readonly) int64_t currentPosition;
/**
@brief 获取当前播放位置的utc时间支持KVO
*/
/****
@brief Query the current playback utc time. KVO is supported.
*/
@property(nonatomic, readonly) int64_t currentUtcTime;
/**
@brief 获取当前播放命中的缓存文件大小支持KVO
*/
/****
@brief Query the current playback cached file size. KVO is supported.
*/
@property(nonatomic, readonly) int64_t localCacheLoadedSize;
/**
@brief 获取当前下载速度支持KVO
*/
/****
@brief Query the current download speed. KVO is supported.
*/
@property(nonatomic, readonly) int64_t currentDownloadSpeed;
/**
@brief 获取已经缓存的位置支持KVO
*/
/****
@brief Query the buffered position. KVO is supported.
*/
@property (nonatomic, readonly) int64_t bufferedPosition;
/**
@brief 设置代理参考AVPDelegate
@see AVPDelegate
*/
/****
@brief Set a proxy. See AVPDelegate.
@see AVPDelegate
*/
@property (nonatomic, weak) id<AVPDelegate> delegate;
/**
@brief 设置渲染回调。废弃使用renderingDelegate。
*/
/****
@brief Set the render callback. Deprecated, use the renderingDelegate.
*/
@property(nonatomic, weak) id<CicadaRenderDelegate> renderDelegate __deprecated;
/**
@brief 设置渲染回调。
*/
/****
@brief Set the render callback.
*/
@property(nonatomic, weak) id<CicadaRenderingDelegate> renderingDelegate;
/**
@brief 设置埋点事件回调。
*/
/****
@brief Set the event report callback.
*/
@property (nonatomic, weak) id <AVPEventReportParamsDelegate> eventReportParamsDelegate;
/**
@brief 设置AudioSession的Delegate
@param delegate Delegate对象
*/
/****
@brief Set AudioSession Delegate
@param delegate the Delegate
*/
+ (void)setAudioSessionDelegate:(id<CicadaAudioSessionDelegate>)delegate;
/**
@brief 是否打开log输出
@param enableLog true表示输出log
@see 使用setLogCallbackInfo
*/
/****
@brief Enable or disable logging.
@param enableLog set as true to output log
@see Use setLogCallbackInfo.
*/
+(void)setEnableLog:(BOOL)enableLog;
/**
@brief 设置日志打印回调block异步
@param logLevel log输出级别
@param callbackBlock log回调block可以为nil
*/
/****
@brief Set a log output callback block. Asynchronous.
@param logLevel The level of the log.
@param callbackBlock Log output callback block, which can be nil.
*/
+(void) setLogCallbackInfo:(AVPLogLevel)logLevel callbackBlock:(void (^)(AVPLogLevel logLevel,NSString* strLog))block;
/**
@brief 设置校验AVPStsInfo是否过期回调
@param callback
*/
/****
@brief Set the AVPStsInfo expiration callback
@param callback
*/
-(void) setVerifyStsCallback:(AVPStsStatus (^)(AVPStsInfo info)) callback;
/**
@brief 设置期望使用的播放器名字。
@param name 期望使用的播放器名字
*/
/****
@brief Set preper player name.
@param name preper player name.
*/
- (void)setPreferPlayerName:(NSString *)name;
/**
@brief 获取播放时使用的播放器名字
*/
/****
@brief Get used player name
*/
- (NSString *)getPlayerName;
/**
@brief 设置视频标签。值范围[0,99]。
*/
/****
@brief Set the video tags. Values range from [0,99].
*/
- (void)setVideoTag:(int *)tags size:(int)size;
/**
@brief 发送用户自定义事件将通过AVPEventReportParamsDelegate回调。事件 e = 5001。
*/
/****
@brief Send custom event, will callback through AVPEventReportParamsDelegate. Event id e = 5001.
*/
- (void)sendCustomEvent:(NSString *)args;
/**
@brief 设置UserData用于一些全局API的透传以区分player实例。
*/
/****
@brief Set user data, and will be passed to some global API, so that client can know from which player
instance
*/
- (void)setUserData:(NSString *)userData;
/**
@brief 获取UserData一个实例绑定一个。
*/
/****
@brief Get user data, and each player instance bind one.
*/
- (NSString *)getUserData;
/**
@brief 重连所有网络连接,网络路由发生变化后,调用此接口,可以让播放器所有的连接切换到新的路由上去。
*/
/****
@brief reconnect all connections, call this when netWork router changed, and the player will use new router.
*/
+ (void)netWorkReConnect;
/**
@brief 设置画中画功能开启/关闭 (目前播放器自带的画中画功能需要iOS15以上的系统如果其他系统可以通过播放器CicadaRenderingDelegate返回的pixelbuffer来自定义实现)
*/
/****
@brief Set picture in picture enable (The picture in picture function of the player requires systems above ios15. If other systems are available, they can be customized through the pixelbuffer returned by the player cicadarenderingdelegate)
*/
- (void)setPictureInPictureEnable:(BOOL)enable;
@end

View File

@@ -0,0 +1,203 @@
//
// AliPlayerGlobalSettings.h
// AliPlayerGlobalSettings
//
// Created by huang_jiafa on 2020/04/09.
// Copyright © 2020 com.alibaba.AliyunPlayer. All rights reserved.
//
#import "AVPDef.h"
#import <Foundation/Foundation.h>
OBJC_EXPORT
@interface AliPlayerGlobalSettings : NSObject
/**
@brief 设置域名对应的解析ip
@param host 域名需指定端口http默认端口80https默认端口443。例如player.alicdn.com:443
@param ip 相应的ip设置为空字符串清空设定。
*/
/****
@brief Set a DNS ip to resolve the host.
@param host The host. Need to specify the port (http defualt port is 80https default port is 443). E.g player.alicdn.com:443
@param ip The ip address, set as empty string to clear the setting.
*/
+(void)setDNSResolve:(NSString *)host ip:(NSString *)ip;
/**
@brief 设置解析ip类型
@param type 解析ip的类型
*/
/****
@brief Set a IP type when resolve the host.
@param type The IP type.
*/
+(void)setIpResolveType:(AVPIpResolveType)type;
/**
@brief 设置是否使用http2。
@param use
*/
/****
@brief Set use http2 or not。
@param use
*/
+ (void)setUseHttp2:(bool)use;
/**
@brief 设置fairPlay的用户证书id, 每次设置必须在同一个线程,否则无法更新
@param certID 用户证书id
*/
/****
@brief Set the .fairPlay certID, update the certID must use the thread first set
@param type The IP type.
*/
+(void)setFairPlayCertID:(NSString *)certID;
/**
@brief 设置是否使能硬件提供的音频变速播放能力关闭后则使用软件实现音频的倍速播放pcm回调数据的格式和此设置关联,如果修改,请在同一个线程操作,默认打开
*/
/****
@brief enable/disable hardware audio tempo, player will use soft ware tempo filter when disabled, and it will affect the pcm data that from audio rending callback, it only can be reset in the same thread, enable by default.
*/
+ (void)enableHWAduioTempo:(bool)enable;
/**
@brief 强制音频渲染器采用指定的格式进行渲染如果设定的格式设备不支持则无效无效值将被忽略使用默认值pcm回调数据的格式和此设置关联,如果修改,请在同一个线程操作,默认关闭
@param force 打开/关闭 强制设置
@param fmt 设置pcm的格式目前只支持s1616位有符号整数
@param channels 设置pcm的声道数有效值 1~8
@param sample_rate 设置pcm的采样率有效值 148000
*/
/****
@brief force audio render use the particular format,the value will no effect when the format not supported by devicethe out range value will be ignoredand use the default value;
and it will affect the pcm data that from audio rending callback, it only can be reset in the same thread, disabled by default.
@param force enable/disable
@param fmt the pcm format, only support s16 for now, signed integer with 16 bits
@param channels the pcm channels available range 18
@param sample_rate set the pcm sample rate available range 148000
*/
+ (void)forceAudioRendingFormat:(bool)force fmt:(NSString *)fmt channels:(int)channels sample_rate:(int)sample_rate;
/**
@brief 开启本地缓存,开启之后,就会缓存到本地文件中。
@param enable true开启本地缓存。false关闭。默认关闭。
@param maxBufferMemoryKB 设置单个源的最大内存占用大小。单位KB
@param localCacheDir 本地缓存的文件目录,绝对路径
*/
/****
@brief Enable local cache. When enabled, it will be cached in local files.
@param enable true: enables the local cache. false: disable. This function is disabled by default.
@param maxBufferMemoryKB Set the maximum memory size for a single source. Unit is KB
@param localCacheDir Directory of files cached locally, absolute path
*/
+ (void)enableLocalCache:(bool)enable maxBufferMemoryKB:(int)maxBufferMemoryKB localCacheDir:(NSString *)localCacheDir;
/**
@brief 本地缓存文件自动清理相关的设置
@param expireMin 缓存多久过期单位分钟默认值30天过期的缓存不管容量如何都会在清理时淘汰掉
@param maxCapacityMB 最大缓存容量单位兆默认值20GB在清理时如果缓存总大小超过此大小会以cacheItem为粒度按缓存的最后时间排序一个一个淘汰掉一些缓存直到小于等于最大缓存容量
@param freeStorageMB 磁盘最小空余容量单位兆默认值0在清理时同最大缓存容量如果当前磁盘容量小于该值也会按规则一个一个淘汰掉一些缓存直到freeStorage大于等于该值或者所有缓存都被干掉
*/
/****
@brief Settings related to automatic clearing of local cache files
@param expireMin How long the cache expires: the unit is minute. The default value is 30 days.
@param maxCapacityMB maximum cache capacity: in megabytes. The default value is 20GB. If the total cache size exceeds this size, some caches are discarded one by one in the cacheItem granularity until they are smaller than or equal to the maximum cache capacity.
@param freeStorageMB Minimum free disk capacity: in megabytes. The default value is 0. If the current disk capacity is less than this value, the freeStorage will be eliminated one by one until the freeStorage is greater than or equal to this value or all caches are eliminated.
*/
+ (void)setCacheFileClearConfig:(int64_t)expireMin maxCapacityMB:(int64_t)maxCapacityMB freeStorageMB:(int64_t)freeStorageMB;
/**
@brief 回调方法
@param url 视频url
@return hash值必须要保证每个url都不一样
*/
/****
@brief callback
@param url the loaded URL
@return the hash value . Ensure that each URL is different.
*/
typedef NSString *(*CaheUrlHashCallback)(NSString *url);
/**
@brief 设置加载url的hash值回调。如果不设置SDK使用md5算法。
*/
/****
@brief Sets the hash callback to load the URL. If this parameter is not set, the SDK uses md5 algorithm.
*/
+ (void)setCacheUrlHashCallback:(CaheUrlHashCallback)callback;
/**
@brief 媒体数据从网络下来后有机会回调出去可对原始数据进行处理目前只支持mp4
@param requestUrl 数据归属的URL
@param inData 输入数据buffer
@param inOutSize 输入输出数据buffer大小单位字节
@param outData 输出数据buffer处理后的数据可写入这里大小必须与inOutSize一样其内存由sdk内部申请无需管理内存
@return 是否处理过了。如果处理了返回YESsdk会以outData中的数据做后续处理否则返回NO继续使用原始数据
*/
/****
@brief A chance for media data downloading from network and modified by app, now only mp4 is supported
@param requestUrl data's source URL
@param inData input data buffer
@param inOutSize input/output data buffer size in byte
@param outData output data buffer and its memory is managed by sdk, app can write it but size must not exceed to inOutSize
@return whether processed. If processed, return YES and sdk will use outData for later process, otherwise use original data and return NO.
*/
typedef BOOL (*NetworkDataProcessCallback)(NSString *requestUrl,
const uint8_t *inData,
const int64_t inOutSize,
uint8_t *outData);
/**
@brief 设置网络数据回调。
*/
/****
@brief Set the network data callback.
*/
+ (void)setNetworkDataProcessCallback:(NetworkDataProcessCallback)callback;
/**
@brief 是否开启httpDNS。默认不开启。
@param enable
*/
/****
@brief enable httpDNS. Default is disabled.
@param enable
*/
+ (void)enableHttpDns:(BOOL)enable;
/**
@brief 是否开启内建预加载网络平衡策略,播放过程中,自动控制预加载的运行时机。默认开启。
@param enable
*/
/****
@brief enable Network Balance mechanism for control media loader's scheduling automatically. Default is enabled.
@param enable
*/
+ (void)enableNetworkBalance:(BOOL)enable;
/**
@brief 是否开启缓冲buffer到本地缓存开启后如果maxBufferDuration大于50s则大于50s到部分会缓存到本地缓存。默认关闭。
@param enable
*/
/****
@brief enable buffer to local cache when maxBufferDuration large than 50s. Default is enabled.
@param enable
*/
+ (void)enableBufferToLocalCache:(BOOL)enable;
+ (void) clearCaches;
/**
@brief 播放器实例禁用crash堆栈上传
@param disable
*/
/****
@brief whether disable crash upload
@param disable
*/
+ (void) disableCrashUpload:(BOOL) disable;
@end

View File

@@ -0,0 +1,154 @@
//
// AliPlayerPictureInPictureDelegate.h
// AliyunPlayer
//
// Created by alibaba on 2022/7/4.
// Copyright © 2022 com.alibaba.AliyunPlayer. All rights reserved.
#ifndef AliPlayerPictureInPictureDelegate_h
#define AliPlayerPictureInPictureDelegate_h
#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#import <AVKit/AVKit.h>
#import <AVFoundation/AVFoundation.h>
#elif TARGET_OS_OSX
#import <AppKit/AppKit.h>
#endif
@protocol AliPlayerPictureInPictureDelegate <NSObject>
@optional
/**
@brief 画中画将要启动
@param pictureInPictureController 画中画控制器
*/
/****
@brief picture in picture will start
@param pictureInPictureController picture in picture controller
*/
- (void)pictureInPictureControllerWillStartPictureInPicture:(AVPictureInPictureController * _Nullable)pictureInPictureController;
/**
* @brief 画中画已经启动
* @param pictureInPictureController 画中画控制器
*/
/****
@brief picture in picture start already
@param pictureInPictureController picture in picture controller
*/
- (void)pictureInPictureControllerDidStartPictureInPicture:(AVPictureInPictureController * _Nullable)pictureInPictureController;
/**
@brief 画中画准备停止
@param pictureInPictureController 画中画控制器
*/
/****
@brief picture in picture will stop
@param pictureInPictureController picture in picture controller
*/
- (void)pictureInPictureControllerWillStopPictureInPicture:(AVPictureInPictureController * _Nullable)pictureInPictureController;
/**
@brief 画中画已经停止
@param pictureInPictureController 画中画控制器
*/
/****
@brief picture in picture stop already
@param pictureInPictureController picture in picture controller
*/
- (void)pictureInPictureControllerDidStopPictureInPicture:(AVPictureInPictureController * _Nullable)pictureInPictureController;
/**
@brief 画中画打开失败
@param pictureInPictureController 画中画控制器
*/
/****
@brief picture in picture start failed
@param pictureInPictureController picture in picture controller
@param error error type
*/
- (void)pictureInPictureController:(AVPictureInPictureController * _Nullable)pictureInPictureController failedToStartPictureInPictureWithError:(NSError * _Nullable)error;
/**
@brief 在画中画停止前告诉代理恢复用户接口
@param pictureInPictureController 画中画控制器
@param completionHandler 调用并传值YES以允许系统结束恢复播放器用户接口
*/
/****
@brief Tells the delegate to restore the user interface before Picture in Picture stops.
@param pictureInPictureController picture in picture controller
@param completionHandlerYou must call the completion handler with a value of YES to allow the system to finish restoring your player user interface.
*/
- (void)pictureInPictureController:(AVPictureInPictureController * _Nullable)pictureInPictureController restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:(void (^_Nullable)(BOOL restored))completionHandler;
/**
@brief 画中画窗口尺寸变化
@param pictureInPictureController 画中画控制器
@param newRenderSize 新的窗口尺寸
*/
/****
@brief picture in picture stop already
@param pictureInPictureController picture in picture controller
@param newRenderSize new render size
*/
- (void)pictureInPictureController:(nonnull AVPictureInPictureController *)pictureInPictureController didTransitionToRenderSize:(CMVideoDimensions)newRenderSize;
/**
@brief 点击画中画暂停按钮
@param pictureInPictureController 画中画控制器
@param playing 是否正在播放
*/
/****
@brief picture in picture stop already
@param pictureInPictureController picture in picture controller
@param playing is playing or not
*/
- (void)pictureInPictureController:(nonnull AVPictureInPictureController *)pictureInPictureController setPlaying:(BOOL)playing;
/**
@brief 点击快进或快退按钮
@param pictureInPictureController 画中画控制器
@param skipInterval 快进快退的事件间隔
@param completionHandler 一定要调用的闭包,表示跳转操作完成
*/
/****
@brief Informs delegate that the user has requested skipping forward or backward by the time indicated by the interval.
@param pictureInPictureController picture in picture controller
@param skipInterval The interval by which to skip playback.
@param completionHandler A closure that must be invoked to indicate that the skip operation has completed.
*/
- (void)pictureInPictureController:(nonnull AVPictureInPictureController *)pictureInPictureController skipByInterval:(CMTime)skipInterval completionHandler:(nonnull void (^)(void))completionHandler;
/**
@brief 将暂停/播放状态反映到UI上
@param pictureInPictureController 画中画控制器
@return 暂停/播放
*/
/****
@brief Allows delegate to indicate whether the playback UI should reflect a playing or paused state
@param pictureInPictureController picture in picture controller
@return play/pause
*/
- (BOOL)pictureInPictureControllerIsPlaybackPaused:(nonnull AVPictureInPictureController *)pictureInPictureController;
/**
@brief 通知画中画控制起当前可播放的时间范围
@param pictureInPictureController 画中画控制器
@return 当前可播放的时间范围
*/
/****
@brief Allows delegate to inform Picture in Picture controller of the current playable time range.
@param pictureInPictureController picture in picture controller
@return current playable time range
*/
- (CMTimeRange)pictureInPictureControllerTimeRangeForPlayback:(nonnull AVPictureInPictureController *)pictureInPictureController layerTime:(CMTime)layerTime;
@end
#endif /* AliPlayerPictureInPictureDelegate_h */

View File

@@ -0,0 +1,48 @@
//
// AliPrivateService.h
// AliPrivateService
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#import <Foundation/Foundation.h>
OBJC_EXPORT
@interface AliPrivateService : NSObject
/**
@brief 初始化下载秘钥信息
@param datFile 秘钥文件的路径
*/
/****
@brief Initialize the credential for downloading resources.
@param datFile The path of the credential file.
*/
+ (void)initKey:(NSString*)datFile;
/**
@brief 初始化下载秘钥信息
@param data 秘钥文件的内容
*/
/****
@brief Initialize the credential for downloading resources.
@param data The data of the credential file.
*/
+ (void)initKeyWithData:(NSData*)data;
/**
@brief 初始化证书服务
@param key 用户拥有的licenseKey信息
@param licensePath 本地证书路径
@param storageDir 下载证书文件夹路径
*/
/****
@brief Initialize the license service.
@param key license key that user have
@param licensePath local license file path
@param storageDir download license file folder path
*/
+ (void)initLicenseService;
@end

View File

@@ -0,0 +1,186 @@
//
// AliVRPlayer.h
// AliyunPlayer
//
// Created by tony on 2022/5/31.
//
#import "AliPlayer.h"
#import "AliVRPlayerDelegate.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, AliVRPlayerViewDisplayMode)
{
AliVRPlayerViewDisplayMode360,
AliVRPlayerViewDisplayModeGlass
};
typedef NS_OPTIONS(NSUInteger, AliVRPlayerInteractiveOptions)
{
AliVRPlayerInteractiveOptionsPinch = 1 << 0, // Pinch手势 默认关闭
AliVRPlayerInteractiveOptionsHorizontal = 1 << 1, // 水平方向的滑动, 默认关闭
AliVRPlayerInteractiveOptionsVerticalEnabled = 1 << 2, // 竖直方向的滑动, 默认关闭
AliVRPlayerInteractiveOptionsDeviceMotion = 1 << 3, // 通过手机陀螺仪进行体验, 默认开启
AliVRPlayerInteractiveOptionsCustomGesture = 1 << 4,
};
typedef NS_ENUM(NSInteger, AliVRPlayerViewOrientation) {
AliVRPlayerViewOrientationPortrait,
AliVRPlayerViewOrientationUpsideDown,
AliVRPlayerViewOrientationLandscapeLeft,
AliVRPlayerViewOrientationLandscapeRight,
};
typedef NS_ENUM(NSInteger, AliVRPlayerType) {
AliVRPlayerTypeSCN,
AliVRPlayerTypeOpenGL,
};
OBJC_EXPORT
@interface AliVRPlayer : AliPlayer
/**
@brief 初始化播放器
*/
/**
@brief Initialize the player.
*/
- (instancetype)init;
/**
@brief 初始化播放器
@param traceID 便于跟踪日志,设为"DisableAnalytics"可关闭日志分析系统(不推荐)。
*/
/**
@brief Initialize the player.
@param traceID A trace ID for debugging. Set as "DisableAnalytics" to disable report analytics data to server(not recommended).
*/
- (instancetype)init:(NSString*)traceID;
/**
@brief 设置VR播放器的交互类型为开启或者关闭
@param option AliVRPlayerInteractiveOptionsPinch、AliVRPlayerInteractiveOptionsVerticalEnabled、AliVRPlayerInteractiveOptionsHorizontal、AliVRPlayerInteractiveOptionsDeviceMotion
@param enable YES or NO (默认是AliVRPlayerInteractiveOptionsDeviceMotion开启状态其他的为关闭状态)
*/
/**
@brief Set VRPlayer Interactive mode
@param option AliVRPlayerInteractiveOptionsPinch、AliVRPlayerInteractiveOptionsVerticalEnabled、AliVRPlayerInteractiveOptionsHorizontal、AliVRPlayerInteractiveOptionsDeviceMotion
@param enable YES or NO (Default is AliVRPlayerInteractiveOptionsDeviceMotion YESothers is NO )
*/
- (void)setInteractionOptions:(AliVRPlayerInteractiveOptions)option enabled:(BOOL)enable;
/**
@brief 设置VR播放器的展示方式
@param displayMode AliVRPlayerViewDisplayMode360 or AliVRPlayerViewDisplayModeGlass默认值为 AliVRPlayerViewDisplayMode360
*/
/**
@brief Set VRPlayer display mode (AliVRPlayerViewDisplayMode360 or AliVRPlayerViewDisplayModeGlass)
@param displayMode AliVRPlayerViewDisplayMode360 or AliVRPlayerViewDisplayModeGlass (Default value is AliVRPlayerViewDisplayMode360)
*/
- (void)setDisplayMode:(AliVRPlayerViewDisplayMode)displayMode;
/**
@brief 设置VR播放器的放大倍数
@param scale
*/
/**
@brief Set VRPlayer view scale
@param scale
*/
- (void)setVRSceneScale:(CGFloat)scale;
/**
@brief 设置VR播放器场景的旋转
@param rotate 旋转的弧度数
*/
/**
@brief Set VRPlayer scene rotate
@param rotate radians of rotate
*/
- (void)setVRSceneRotate:(CGFloat)rotate;
/**
@brief 设置VR播放器旋转的角度
@param x x轴旋转的角度
@param y y轴旋转的角度
*/
/**
@brief Set VRPlayer rotate radians with axis
@param x radians of rotate on x axis
@param y radians of rotate on y axis
*/
- (void)rotateVRSceneWithX:(CGFloat)x andY:(CGFloat)y;
/**
@brief 通过手势控制vr播放器的角度
@param paramSender 滑动手势
*/
/**
@brief Set VRPlayer rotate radians with axis
@param paramSender Pan Gesture
*/
- (void)handlePanGesture:(UIPanGestureRecognizer *)paramSender;
/**
@brief 设置播放器显示全景图
@param image 要展示的全景图
*/
/**
@brief Set VRPlayer display with 360 image
@param image 360 image
*/
- (void)setVRDisplayContentsWithImage:(UIImage *)image;
/**
@brief 设置播放器VR处理器类型
@param vrType VR处理器的类型
*/
/**
@brief set VR processor type
@param vrType VR processor type
*/
- (void)setVRPlayerType:(AliVRPlayerType)vrType;
/**
@brief 设置播放器VR代理用来接收 回调信息或进行代理操作
@param delegate VR代理
*/
/**
@brief set VR delegate, to receive callback information or delegate operation
@param delegate VR delegate
*/
- (void)setVRDelegate:(id<AliVRPlayerDelegate>)delegate;
/**
@brief 重设播放器VR的手势角度
*/
/**
@brief reset VR gesture angle
*/
- (void)resetGestureAngle;
/**
@brief 设置播放器VR视频背景色
@param color 背景颜色
*/
/**
@brief set VR video background color
@param color background color
*/
- (void)setVideoBackgroundColor:(UIColor *)color;
/**
@brief 设置缩放
@param degrees 缩放程度
*/
/**
@brief set scale
@param degrees
*/
- (void)setFovDegrees:(CGFloat)degrees;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,34 @@
//
// Created by yiliang on 2023/4/12.
//
#ifndef SOURCE_ALIVRPLAYERDELEGATE_H
#define SOURCE_ALIVRPLAYERDELEGATE_H
@protocol AliVRPlayerDelegate <NSObject>
@optional
/**
@brief vr的运动传感器角度发生改变
@param sensorAngleX 传感器的水平角度
*/
/****
@brief vr's motion sensor changed
@param sensorAngleX sensor horizontal angle
*/
- (void)motionSensorAngleChanged:(CGFloat)sensorAngleX;
/**
@brief 手势角度发生改变
@param gestureAngleX 手势的水平角度
*/
/****
@brief gesture angle changed
@param gestureAngleX gesture horizontal angle
*/
- (void)gestureAngleChanged:(CGFloat)gestureAngleX;
@end
#endif //SOURCE_ALIVRPLAYERDELEGATE_H

View File

@@ -0,0 +1,82 @@
#import "AVPDef.h"
#import <Foundation/Foundation.h>
@class AVPMediaInfo;
@class AVPVidStsSource;
@class AVPVidAuthSource;
@protocol AliVodMediaLoaderStatusDelegate <NSObject>
@optional
/**
@brief 准备完成
*/
- (void)onPrepared:(AVPMediaInfo *)mediaInfo;
/**
@brief 错误回调
@param url 加载url
@param code 错误码
@param msg 错误描述
*/
- (void)onError:(NSString *)vid index:(int)index code:(int64_t)code msg:(NSString *)msg;
/**
@brief 完成回调
@param url 加载url
*/
- (void)onCompleted:(NSString *)vid index:(int)index;
/**
@brief 取消回调
@param url 加载url
*/
- (void)onCanceled:(NSString *)vid index:(int)index;
@end
OBJC_EXPORT
@interface AliVodMediaLoader : NSObject
+ (instancetype)shareInstance;
- (void)prepareVidStsSource:(AVPVidStsSource *)stsSource;
- (void)prepareVidAuthSource:(AVPVidAuthSource *)authSource;
- (void)removeVidSource:(NSString *)vid;
/**
@brief 开始加载文件。异步加载。可以同时加载多个。
@param url 视频文件地址
@param duration 加载的时长大小.单位:毫秒
*/
- (void)load:(NSString *)vid index:(int)index duration:(int64_t)duration;
/**
@brief 取消加载。注意:不会删除已经下载的文件。
@param url 视频文件地址 。为nil或者空则取消全部。
*/
- (void)cancel:(NSString *)vid index:(int)index;
/**
@brief 暂停加载。
@param url 视频文件地址。 为nil或者空则暂停全部。
*/
- (void)pause:(NSString *)vid index:(int)index;
/**
@brief 恢复加载。
@param url 视频文件地址。 为nil或者空则恢复全部。
*/
- (void)resume:(NSString *)vid index:(int)index;
/**
@brief 设置状态代理参考AliMediaLoaderStatusDelegate
@see AliMediaLoaderStatusDelegate
*/
- (void)setAliVodMediaLoaderStatusDelegate:(id<AliVodMediaLoaderStatusDelegate>)delegate;
@end

View File

@@ -0,0 +1,39 @@
//
// AliPlayerHeader.h
// AliPlayerHeader
//
// Created by shiping.csp on 2018/12/3.
// Copyright © 2018 shiping.csp. All rights reserved.
//
//! Project version number for AliPlayerHeader.
//FOUNDATION_EXPORT double AliPlayerHeaderVersionNumber;
//! Project version string for AliPlayerHeader.
//FOUNDATION_EXPORT const unsigned char AliPlayerHeaderVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <AliPlayerHeader/PublicHeader.h>
#import <AliyunPlayer/AMDDelegate.h>
#import <AliyunPlayer/AVPCacheConfig.h>
#import <AliyunPlayer/AVPConfig.h>
#import <AliyunPlayer/AVPPreloadConfig.h>
#import <AliyunPlayer/AVPDef.h>
#import <AliyunPlayer/AVPDelegate.h>
#import <AliyunPlayer/AliPlayerPictureInPictureDelegate.h>
#import <AliyunPlayer/AVPFilterConfig.h>
#import <AliyunPlayer/AVPLiveTimeShift.h>
#import <AliyunPlayer/AVPMediaInfo.h>
#import <AliyunPlayer/AVPSource.h>
#import <AliyunPlayer/AliListPlayer.h>
#import <AliyunPlayer/AliMediaLoader.h>
#import <AliyunPlayer/AliPlayer.h>
#import <AliyunPlayer/AliVRPlayer.h>
#import <AliyunPlayer/AliVRPlayerDelegate.h>
#import <AliyunPlayer/AliPlayerGlobalSettings.h>
#import <AliyunPlayer/AliPrivateService.h>
#import <AliyunPlayer/AliVodMediaLoader.h>
#import <AliyunPlayer/CicadaAudioSessionDelegate.h>
#import <AliyunPlayer/CicadaRenderDelegate.h>
#import <AliyunPlayer/CicadaRenderingDelegate.h>
#import <AliyunPlayer/VidPlayerConfigGen.h>

View File

@@ -0,0 +1,20 @@
#ifndef CicadaAudioSessionDelegate_h
#define CicadaAudioSessionDelegate_h
#import <AVFoundation/AVFoundation.h>
#import <TargetConditionals.h>
@protocol CicadaAudioSessionDelegate <NSObject>
#if TARGET_OS_IPHONE
@optional
- (BOOL)setActive:(BOOL)active error:(NSError **)outError;
@optional
- (BOOL)setCategory:(NSString *)category withOptions:(AVAudioSessionCategoryOptions)options error:(NSError **)outError;
@optional
- (BOOL)setCategory:(AVAudioSessionCategory)category mode:(AVAudioSessionMode)mode routeSharingPolicy:(AVAudioSessionRouteSharingPolicy)policy options:(AVAudioSessionCategoryOptions)options error:(NSError **)outError;
#endif
@end
#endif /* CicadaAudioSessionDelegate_h */

View File

@@ -0,0 +1,127 @@
#ifndef CicadaFrameInfo_h
#define CicadaFrameInfo_h
#import <Foundation/Foundation.h>
#import <CoreVideo/CoreVideo.h>
typedef enum CicadaFrameType : NSUInteger{
Cicada_FrameType_Unknown,
Cicada_FrameType_Video,
Cicada_FrameType_Audio
} CicadaFrameType;
typedef enum CicadaSampleFormat : NSInteger {
CICADA_SAMPLE_FMT_NONE = -1,
CICADA_SAMPLE_FMT_U8, ///< unsigned 8 bits
CICADA_SAMPLE_FMT_S16, ///< signed 16 bits
CICADA_SAMPLE_FMT_S32, ///< signed 32 bits
CICADA_SAMPLE_FMT_FLT, ///< float
CICADA_SAMPLE_FMT_DBL, ///< double
CICADA_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar
CICADA_SAMPLE_FMT_S16P, ///< signed 16 bits, planar
CICADA_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
CICADA_SAMPLE_FMT_FLTP, ///< float, planar
CICADA_SAMPLE_FMT_DBLP, ///< double, planar
CICADA_SAMPLE_FMT_NB, ///< Number of sample formats. DO NOT USE if linking dynamically
} CicadaSampleFormat;
typedef enum CicadaPixelFormat : NSInteger {
CICADA_PIX_FMT_NONE = -1,
CICADA_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
CICADA_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
CICADA_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
CICADA_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
CICADA_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
CICADA_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
CICADA_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
CICADA_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
CICADA_PIX_FMT_GRAY8, ///< Y , 8bpp
CICADA_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each
///< byte pixels are ordered from the msb to the lsb
CICADA_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each
///< byte pixels are ordered from the msb to the lsb
CICADA_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette
CICADA_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in
///< favor of AV_PIX_FMT_YUV420P and setting color_range
CICADA_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in
///< favor of AV_PIX_FMT_YUV422P and setting color_range
CICADA_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in
///< favor of AV_PIX_FMT_YUV444P and setting color_range
CICADA_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
CICADA_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
CICADA_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
CICADA_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a
///< byte contains two pixels, the first pixel in the byte is the
///< one composed by the 4 msb bits
CICADA_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
CICADA_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
CICADA_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a
///< byte contains two pixels, the first pixel in the byte is the
///< one composed by the 4 msb bits
CICADA_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
CICADA_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the
///< UV components, which are interleaved (first byte U and the
///< following byte V)
CICADA_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
CICADA_PIX_FMT_YUV420P10BE = 63, ///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb
///< sample per 2x2 Y samples), big-endian
CICADA_PIX_FMT_YUV420P10LE, ///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb
///< sample per 2x2 Y samples), little-endian
CICADA_PIX_FMT_D3D11 = 900,
CICADA_PIX_FMT_DXVA2_VLD,
CICADA_PIX_FMT_APPLE_PIXEL_BUFFER = 1000,
CICADA_PIX_FMT_CICADA_AF, // framework VideoFrame
CICADA_PIX_FMT_CICADA_MEDIA_CODEC, // Android mediacodec buffer index
} CicadaPixelFormat;
OBJC_EXPORT
@interface CicadaFrameInfo : NSObject
@property(nonatomic, assign) CicadaFrameType frameType;
@property(nonatomic, assign) long pts;
@property(nonatomic, assign) long duration;
@property(nonatomic, assign) BOOL key;
@property(nonatomic, assign) long timePosition;
@property(nonatomic, assign) CicadaSampleFormat audio_format;
@property(nonatomic, assign) int audio_nb_samples;
@property(nonatomic, assign) int audio_channels;
@property(nonatomic, assign) int audio_sample_rate;
@property(nonatomic, assign) uint64_t audio_channel_layout;
@property(nonatomic, assign) int audio_data_lineNum;
@property(nonatomic, assign) uint8_t ** audio_data;
@property(nonatomic, assign) int audio_data_lineSize;
@property(nonatomic, assign) CicadaPixelFormat video_format;
@property(nonatomic, assign) int video_width;
@property(nonatomic, assign) int video_height;
@property(nonatomic, assign) int video_rotate;
@property(nonatomic, assign) double video_dar;
@property(nonatomic, assign) size_t video_crop_top;
@property(nonatomic, assign) size_t video_crop_bottom;
@property(nonatomic, assign) size_t video_crop_left;
@property(nonatomic, assign) size_t video_crop_right;
@property(nonatomic, assign) int video_colorRange;
@property(nonatomic, assign) int video_colorSpace;
@property(nonatomic, assign) int video_data_lineNum;
@property(nonatomic, assign) int* video_data_lineSize;
@property(nonatomic, assign) uint8_t ** video_data_addr;
@property(nonatomic, assign) CVPixelBufferRef video_pixelBuffer;
@property(nonatomic, assign) int sei_type;
@property(nonatomic, assign) char *sei_data;
@property(nonatomic, assign) int sei_data_size;
@end
#endif /* CicadaFrameInfo_h */

View File

@@ -0,0 +1,23 @@
#import <Foundation/Foundation.h>
@protocol CicadaRenderDelegate <NSObject>
@optional
/**
* 视频硬解渲染帧回调
* @param pixelBuffer 渲染帧
* @param pts 渲染帧pts
* @return 返回YES则SDK不再显示(暂不支持)返回NO则SDK渲染模块继续渲染
*/
- (BOOL)onVideoPixelBuffer:(CVPixelBufferRef)pixelBuffer pts:(int64_t)pts;
/**
* 视频软解渲染帧回调
* @param pixelBuffer 渲染帧
* @param pts 渲染帧pts
* @return 返回YES则SDK不再显示(暂不支持)返回NO则SDK渲染模块继续渲染
*/
- (BOOL)onVideoRawBuffer:(uint8_t **)buffer lineSize:(int32_t *)lineSize pts:(int64_t)pts width:(int32_t)width height:(int32_t)height;
@end

View File

@@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>
@class CicadaFrameInfo;
@protocol CicadaRenderingDelegate <NSObject>
@optional
- (BOOL)onRenderingFrame:(CicadaFrameInfo*) frameInfo;
@end

View File

@@ -0,0 +1,72 @@
//
// VidPlayerConfigGen.h
// AliPlayerSDK
//
// Created by shiping.csp on 2018/11/16.
// Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved.
//
#ifndef VidPlayerConfigGen_h
#define VidPlayerConfigGen_h
#import <Foundation/Foundation.h>
OBJC_EXPORT
@interface VidPlayerConfigGenerator : NSObject
/**
@brief 设置预览时间
@param previewTime 预览时间,单位为秒
*/
/****
@brief Set the preview duration.
@param previewTime The specified preview duration in seconds.
*/
-(void) setPreviewTime:(int)previewTime;
/**
@brief HLS标准加密设置UriToken
@param MtsHlsUriToken 字符串
*/
/****
@brief Set a UriToken for HLS standard encryption.
@param MtsHlsUriToken The UriToken.
*/
-(void) setHlsUriToken:(NSString*)MtsHlsUriToken;
/**
@brief 添加vid的playerconfig参数
@param key: 对应playerConfig中的参数名字
@param value: 对应key参数的值
*/
/****
@brief Add a playerconfig parameter for the specified VID.
@param key: The name of the playerConfig parameter.
@param value: The value of the parameter.
*/
-(void) addVidPlayerConfigByStringValue:(NSString*)key value:(NSString*)value;
/**
@brief 添加vid的playerconfig参数
@param key: 对应playerConfig中的参数名字
@param value: 对应key参数的整形值
*/
/****
@brief Add a playerconfig parameter for the specified VID.
@param key: The name of the playerConfig parameter.
@param value: The value of the parameter.
*/
-(void) addVidPlayerConfigByIntValue:(NSString*)key value:(int)value;
/**
@brief 生成playerConfig
*/
/****
@brief Generate playerConfig.
*/
-(NSString*) generatePlayerConfig;
@end
#endif /* VidPlayerConfigGen_h */