├── AliPlayerPartSDK_iOS.podspec ├── AliPlayerPartSDK_iOS_RTS.podspec ├── AliPlayerSDK_iOS.podspec ├── AliPlayerSDK_iOS_AEM_FILTER.podspec ├── AliPlayerSDK_iOS_ARTC.podspec ├── AliPlayerSDK_iOS_ARTP.podspec ├── AliPlayerSDK_iOS_MPF_FILTER.podspec ├── AliPlayerSDK_iOS_RTS.podspec ├── AliPlayerSDK_iOS_VFI_FILTER.podspec ├── AliyunMediaDownloader.framework ├── AliyunMediaDownloader ├── Headers │ ├── AVDConfig.h │ ├── AliMediaDownloader.h │ └── AliyunMediaDownloader.h ├── Info.plist └── Modules │ └── module.modulemap ├── AliyunPlayer.framework ├── AliyunPlayer ├── Headers │ ├── AMDDelegate.h │ ├── AVPCacheConfig.h │ ├── AVPConfig.h │ ├── AVPDef.h │ ├── AVPDelegate.h │ ├── AVPErrorCode.h │ ├── AVPFilterConfig.h │ ├── AVPLiveKeyGenerator.h │ ├── AVPLiveTimeShift.h │ ├── AVPMediaInfo.h │ ├── AVPSource.h │ ├── AliListPlayer.h │ ├── AliMediaLoader.h │ ├── AliPlayer.h │ ├── AliPlayerGlobalSettings.h │ ├── AliPlayerPictureInPictureDelegate.h │ ├── AliPrivateService.h │ ├── AliVodMediaLoader.h │ ├── AliyunPlayer.h │ ├── CicadaAudioSessionDelegate.h │ ├── CicadaFrameInfo.h │ ├── CicadaRenderDelegate.h │ ├── CicadaRenderingDelegate.h │ └── VidPlayerConfigGen.h ├── Info.plist └── Modules │ └── module.modulemap ├── LICENSE ├── README.md ├── aem_filter.framework ├── Info.plist └── aem_filter ├── alivcffmpeg.framework ├── Info.plist └── alivcffmpeg ├── artcSource.framework ├── Info.plist └── artcSource ├── deletePod.sh ├── mpf_filter.framework ├── Info.plist └── mpf_filter ├── publish_artc.py ├── pushPod.sh ├── pushPod_4.7.x.sh ├── updateVersion.sh └── vfi_filter.framework ├── Info.plist └── vfi_filter /AliPlayerPartSDK_iOS.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AliPlayerPartSDK_iOS" 3 | s.version = "5.5.1.0-27866245" 4 | s.summary = "AliPlayerPartSDK_iOS." 5 | s.description = <<-DESC 6 | It's an SDK for aliyun video vodplay, which implement by Objective-C. 7 | DESC 8 | s.homepage = "https://github.com/aliyunvideo/AliPlayerSDK" 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | s.author = { "aliyunvideo" => "videosdk@service.aliyun.com"} 11 | s.platform = :ios 12 | s.platform = :ios, "8.0" 13 | s.source = { :git => "https://github.com/aliyunvideo/AliPlayerSDK.git", :tag => "#{s.version}" } 14 | 15 | s.pod_target_xcconfig = { 16 | 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' 17 | } 18 | s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' } 19 | 20 | 21 | s.subspec 'AliPlayerPartSDK' do |playerSDK| 22 | playerSDK.vendored_frameworks = 'AliyunPlayer.framework','AliyunMediaDownloader.framework' 23 | playerSDK.frameworks = 'MediaPlayer','CoreGraphics','QuartzCore','CoreVideo','OpenGLES','AVFoundation','CoreMedia','VideoToolbox','AudioToolbox' 24 | end 25 | 26 | #s.frameworks = 'VideoToolBox','MediaPlayer' 27 | #s.libraries = 'z' 28 | s.requires_arc = true 29 | 30 | 31 | end 32 | -------------------------------------------------------------------------------- /AliPlayerPartSDK_iOS_RTS.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AliPlayerPartSDK_iOS_RTS" 3 | s.version = "4.7.5" 4 | s.summary = "AliPlayerPartSDK_iOS_RTS." 5 | s.description = <<-DESC 6 | It's an SDK for aliyun video vodplay, which implement by Objective-C. 7 | DESC 8 | s.homepage = "https://github.com/aliyunvideo/AliPlayerSDK" 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | s.author = { "aliyunvideo" => "videosdk@service.aliyun.com"} 11 | s.platform = :ios 12 | s.platform = :ios, "8.0" 13 | s.source = { :git => "https://github.com/aliyunvideo/AliPlayerSDK.git", :tag => "#{s.version}" } 14 | 15 | 16 | s.subspec 'AliPlayerPartSDK' do |playerSDK| 17 | playerSDK.vendored_frameworks = 'AliyunPlayer.framework','AliyunMediaDownloader.framework','artpSource.framework' 18 | playerSDK.frameworks = 'MediaPlayer','CoreGraphics','QuartzCore','CoreVideo','OpenGLES','AVFoundation','CoreMedia','VideoToolbox','AudioToolbox' 19 | end 20 | 21 | #s.frameworks = 'VideoToolBox','MediaPlayer' 22 | #s.libraries = 'z' 23 | s.requires_arc = true 24 | 25 | 26 | end 27 | -------------------------------------------------------------------------------- /AliPlayerSDK_iOS.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AliPlayerSDK_iOS" 3 | s.version = "5.5.1.0-27866245" 4 | s.summary = "AliPlayerSDK_iOS." 5 | s.description = <<-DESC 6 | It's an SDK for aliyun video vodplay, which implement by Objective-C. 7 | DESC 8 | s.homepage = "https://github.com/aliyunvideo/AliPlayerSDK" 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | s.author = { "aliyunvideo" => "videosdk@service.aliyun.com"} 11 | s.platform = :ios 12 | s.platform = :ios, "8.0" 13 | s.source = { :git => "https://github.com/aliyunvideo/AliPlayerSDK.git", :tag => "#{s.version}" } 14 | 15 | s.pod_target_xcconfig = { 16 | 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' 17 | } 18 | s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' } 19 | 20 | s.subspec 'AliPlayerSDK' do |playerSDK| 21 | playerSDK.vendored_frameworks = 'AliyunPlayer.framework','alivcffmpeg.framework','AliyunMediaDownloader.framework' 22 | playerSDK.frameworks = 'MediaPlayer','CoreGraphics','QuartzCore','CoreVideo','OpenGLES','AVFoundation','CoreMedia','VideoToolbox','AudioToolbox' 23 | end 24 | 25 | #s.frameworks = 'VideoToolBox','MediaPlayer' 26 | #s.libraries = 'z' 27 | s.requires_arc = true 28 | 29 | 30 | end 31 | -------------------------------------------------------------------------------- /AliPlayerSDK_iOS_AEM_FILTER.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AliPlayerSDK_iOS_AEM_FILTER" 3 | s.version = "5.5.1.0-27866245" 4 | s.summary = "AliPlayerSDK_iOS_aem_filter." 5 | s.description = <<-DESC 6 | It's an SDK for aliyun video vodplay, which implement by Objective-C. 7 | DESC 8 | s.homepage = "https://github.com/aliyunvideo/AliPlayerSDK" 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | s.author = { "aliyunvideo" => "videosdk@service.aliyun.com"} 11 | s.platform = :ios 12 | s.platform = :ios, "8.0" 13 | s.source = { :git => "https://github.com/aliyunvideo/AliPlayerSDK.git", :tag => "#{s.version}" } 14 | s.pod_target_xcconfig = { 15 | 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' 16 | } 17 | s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' } 18 | 19 | s.subspec 'AliPlayerSDK' do |playerSDK| 20 | playerSDK.vendored_frameworks = 'aem_filter.framework' 21 | playerSDK.frameworks = 'MediaPlayer','CoreGraphics','QuartzCore','CoreVideo','OpenGLES','AVFoundation','CoreMedia','VideoToolbox','AudioToolbox' 22 | end 23 | 24 | #s.frameworks = 'VideoToolBox','MediaPlayer' 25 | #s.libraries = 'z' 26 | s.requires_arc = true 27 | 28 | 29 | end 30 | -------------------------------------------------------------------------------- /AliPlayerSDK_iOS_ARTC.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AliPlayerSDK_iOS_ARTC" 3 | s.version = "5.5.1.0-27866245" 4 | s.summary = "AliPlayerSDK_iOS_ARTC." 5 | s.description = <<-DESC 6 | It's an SDK for aliyun video vodplay, which implement by Objective-C. 7 | DESC 8 | s.homepage = "https://github.com/aliyunvideo/AliPlayerSDK" 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | s.author = { "aliyunvideo" => "videosdk@service.aliyun.com"} 11 | s.platform = :ios 12 | s.platform = :ios, "8.0" 13 | s.source = { :git => "https://github.com/aliyunvideo/AliPlayerSDK.git", :tag => "#{s.version}" } 14 | s.pod_target_xcconfig = { 15 | 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' 16 | } 17 | s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' } 18 | 19 | s.subspec 'AliPlayerSDK' do |playerSDK| 20 | playerSDK.vendored_frameworks = 'artcSource.framework' 21 | playerSDK.frameworks = 'MediaPlayer','CoreGraphics','QuartzCore','CoreVideo','OpenGLES','AVFoundation','CoreMedia','VideoToolbox','AudioToolbox' 22 | end 23 | 24 | #s.frameworks = 'VideoToolBox','MediaPlayer' 25 | #s.libraries = 'z' 26 | s.requires_arc = true 27 | 28 | 29 | end 30 | -------------------------------------------------------------------------------- /AliPlayerSDK_iOS_ARTP.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AliPlayerSDK_iOS_ARTP" 3 | s.version = "5.3.0" 4 | s.summary = "AliPlayerSDK_iOS_ARTP." 5 | s.description = <<-DESC 6 | It's an SDK for aliyun video vodplay, which implement by Objective-C. 7 | DESC 8 | s.homepage = "https://github.com/aliyunvideo/AliPlayerSDK" 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | s.author = { "aliyunvideo" => "videosdk@service.aliyun.com"} 11 | s.platform = :ios 12 | s.platform = :ios, "8.0" 13 | s.source = { :git => "https://github.com/aliyunvideo/AliPlayerSDK.git", :tag => "#{s.version}" } 14 | s.pod_target_xcconfig = { 15 | 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' 16 | } 17 | s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } 18 | 19 | s.subspec 'AliPlayerSDK' do |playerSDK| 20 | playerSDK.vendored_frameworks = 'artpSource.framework' 21 | playerSDK.frameworks = 'MediaPlayer','CoreGraphics','QuartzCore','CoreVideo','OpenGLES','AVFoundation','CoreMedia','VideoToolbox','AudioToolbox' 22 | end 23 | 24 | #s.frameworks = 'VideoToolBox','MediaPlayer' 25 | #s.libraries = 'z' 26 | s.requires_arc = true 27 | 28 | 29 | end 30 | -------------------------------------------------------------------------------- /AliPlayerSDK_iOS_MPF_FILTER.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AliPlayerSDK_iOS_MPF_FILTER" 3 | s.version = "5.5.1.0-27866245" 4 | s.summary = "AliPlayerSDK_iOS_mpf_filter." 5 | s.description = <<-DESC 6 | It's an SDK for aliyun video vodplay, which implement by Objective-C. 7 | DESC 8 | s.homepage = "https://github.com/aliyunvideo/AliPlayerSDK" 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | s.author = { "aliyunvideo" => "videosdk@service.aliyun.com"} 11 | s.platform = :ios 12 | s.platform = :ios, "8.0" 13 | s.source = { :git => "https://github.com/aliyunvideo/AliPlayerSDK.git", :tag => "#{s.version}" } 14 | s.pod_target_xcconfig = { 15 | 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' 16 | } 17 | s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' } 18 | 19 | s.subspec 'AliPlayerSDK' do |playerSDK| 20 | playerSDK.vendored_frameworks = 'mpf_filter.framework' 21 | playerSDK.frameworks = 'MediaPlayer','CoreGraphics','QuartzCore','CoreVideo','OpenGLES','AVFoundation','CoreMedia','VideoToolbox','AudioToolbox' 22 | end 23 | 24 | #s.frameworks = 'VideoToolBox','MediaPlayer' 25 | #s.libraries = 'z' 26 | s.requires_arc = true 27 | 28 | 29 | end 30 | -------------------------------------------------------------------------------- /AliPlayerSDK_iOS_RTS.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AliPlayerSDK_iOS_RTS" 3 | s.version = "4.7.5" 4 | s.summary = "AliPlayerSDK_iOS_RTS." 5 | s.description = <<-DESC 6 | It's an SDK for aliyun video vodplay, which implement by Objective-C. 7 | DESC 8 | s.homepage = "https://github.com/aliyunvideo/AliPlayerSDK" 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | s.author = { "aliyunvideo" => "videosdk@service.aliyun.com"} 11 | s.platform = :ios 12 | s.platform = :ios, "8.0" 13 | s.source = { :git => "https://github.com/aliyunvideo/AliPlayerSDK.git", :tag => "#{s.version}" } 14 | 15 | 16 | s.subspec 'AliPlayerSDK' do |playerSDK| 17 | playerSDK.vendored_frameworks = 'AliyunPlayer.framework','alivcffmpeg.framework','AlivcConan.framework','AliyunMediaDownloader.framework','artpSource.framework' 18 | playerSDK.frameworks = 'MediaPlayer','CoreGraphics','QuartzCore','CoreVideo','OpenGLES','AVFoundation','CoreMedia','VideoToolbox','AudioToolbox' 19 | end 20 | 21 | #s.frameworks = 'VideoToolBox','MediaPlayer' 22 | #s.libraries = 'z' 23 | s.requires_arc = true 24 | 25 | 26 | end 27 | -------------------------------------------------------------------------------- /AliPlayerSDK_iOS_VFI_FILTER.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AliPlayerSDK_iOS_VFI_FILTER" 3 | s.version = "5.5.1.0-27866245" 4 | s.summary = "AliPlayerSDK_iOS_vfi_filter." 5 | s.description = <<-DESC 6 | It's an SDK for aliyun video vodplay, which implement by Objective-C. 7 | DESC 8 | s.homepage = "https://github.com/aliyunvideo/AliPlayerSDK" 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | s.author = { "aliyunvideo" => "videosdk@service.aliyun.com"} 11 | s.platform = :ios 12 | s.platform = :ios, "8.0" 13 | s.source = { :git => "https://github.com/aliyunvideo/AliPlayerSDK.git", :tag => "#{s.version}" } 14 | s.pod_target_xcconfig = { 15 | 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' 16 | } 17 | s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'GENERATE_INFOPLIST_FILE' => 'YES' } 18 | 19 | s.subspec 'AliPlayerSDK' do |playerSDK| 20 | playerSDK.vendored_frameworks = 'vfi_filter.framework' 21 | playerSDK.frameworks = 'MediaPlayer','CoreGraphics','QuartzCore','CoreVideo','OpenGLES','AVFoundation','CoreMedia','VideoToolbox','AudioToolbox' 22 | end 23 | 24 | #s.frameworks = 'VideoToolBox','MediaPlayer' 25 | #s.libraries = 'z' 26 | s.requires_arc = true 27 | 28 | 29 | end 30 | -------------------------------------------------------------------------------- /AliyunMediaDownloader.framework/AliyunMediaDownloader: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/AliyunMediaDownloader.framework/AliyunMediaDownloader -------------------------------------------------------------------------------- /AliyunMediaDownloader.framework/Headers/AVDConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // AVDConfig.h 3 | // AliPlayerSDK 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #ifndef AVDConfig_h 10 | #define AVDConfig_h 11 | 12 | #import 13 | 14 | OBJC_EXPORT 15 | @interface AVDConfig : NSObject 16 | 17 | /** 18 | @brief 最大超时时间 默认15000毫秒 19 | */ 20 | /**** 21 | @brief Maximum timeout time. Default: 15000 milliseconds. 22 | */ 23 | @property (nonatomic, assign) int timeoutMs; 24 | 25 | /** 26 | @brief 最大连接超时时间 默认5000毫秒 27 | */ 28 | /**** 29 | @brief Maximum connection timeout time. Default: 5000 milliseconds. 30 | */ 31 | @property (nonatomic, assign) int connnectTimoutMs; 32 | 33 | /** 34 | @brief 请求referer 35 | */ 36 | /**** 37 | @brief Request Referer. 38 | */ 39 | @property (nonatomic, copy) NSString *referer; 40 | 41 | /** 42 | @brief user Agent 43 | */ 44 | /**** 45 | @brief UserAgent. 46 | */ 47 | @property (nonatomic, copy) NSString *userAgent; 48 | 49 | /** 50 | @brief httpProxy代理 51 | */ 52 | /**** 53 | @brief HTTP proxy. 54 | */ 55 | @property (nonatomic, copy) NSString *httpProxy; 56 | 57 | @end 58 | 59 | #endif /* AVDConfig_h */ 60 | -------------------------------------------------------------------------------- /AliyunMediaDownloader.framework/Headers/AliMediaDownloader.h: -------------------------------------------------------------------------------- 1 | // 2 | // AliMediaDownloader.h 3 | // AliMediaDownloader 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "AVDConfig.h" 12 | 13 | @class AVPVidStsSource; 14 | @class AVPVidAuthSource; 15 | 16 | 17 | OBJC_EXPORT 18 | @interface AliMediaDownloader : NSObject 19 | 20 | /** 21 | @brief 删除下载文件 22 | @param saveDir 文件保存路径 23 | @param vid vid 24 | @param format 格式 25 | @param index vid对应的下载索引 26 | */ 27 | /**** 28 | @brief Delete a downloaded file. 29 | @param saveDir The path where the file is saved. 30 | @param vid VID. 31 | @param format Format. 32 | @param index The download index corresponds to the VID. 33 | */ 34 | +(int) deleteFile:(NSString *)saveDir vid:(NSString *)vid format:(NSString *)format index:(int)index; 35 | 36 | /** 37 | @brief 初始化下载对象 38 | */ 39 | /**** 40 | @brief Intialize the download object. 41 | */ 42 | - (instancetype)init; 43 | 44 | /** 45 | @brief 销毁下载对象 46 | */ 47 | /**** 48 | @brief Delete the download object. 49 | */ 50 | - (void)destroy; 51 | 52 | /** 53 | @brief 使用AVPVidStsSource准备播放 54 | @param source vid sts的播放方式 55 | */ 56 | /**** 57 | @brief Use AVPVidStsSource to prepare for playback. 58 | @param source vid Play the media through VidSts. 59 | */ 60 | - (void) prepareWithVid:(AVPVidStsSource*)source; 61 | 62 | /** 63 | @brief 鉴权过期,更新AVPVidStsSource信息, 64 | @param source vid sts的信息 65 | */ 66 | /**** 67 | @brief Update the AVPVidStsSource information when the authentication expires. 68 | @param source vid STS information. 69 | */ 70 | - (void) updateWithVid:(AVPVidStsSource*)source; 71 | 72 | /** 73 | @brief 使用AVPVidAuthSource准备播放 74 | @param source vid playAuth的播放方式 75 | */ 76 | /**** 77 | @brief Use AVPVidAuthSource to prepare for playback. 78 | @param source vid Play the media through playAuth. 79 | */ 80 | - (void) prepareWithPlayAuth:(AVPVidAuthSource*)source; 81 | 82 | /** 83 | @brief 鉴权过期,更新AVPVidAuthSource信息, 84 | @param source vid auth的信息 85 | */ 86 | /**** 87 | @brief Update the AVPVidAuthSource information when the authentication expires. 88 | @param source vid Authentication information. 89 | */ 90 | - (void) updateWithPlayAuth:(AVPVidAuthSource*)source; 91 | 92 | /** 93 | @brief 设置下载的保存路径 94 | @param dir 保存文件夹 95 | */ 96 | /**** 97 | @brief Set a path to save the downloaded file. 98 | @param dir The specified path. 99 | */ 100 | - (void) setSaveDirectory:(NSString*)dir; 101 | 102 | /** 103 | @brief 开始下载 104 | */ 105 | /**** 106 | @brief Start downloading. 107 | */ 108 | - (void) start; 109 | 110 | /** 111 | @brief 停止下载 112 | */ 113 | /**** 114 | @brief Pause downloading. 115 | */ 116 | - (void) stop; 117 | 118 | /** 119 | @brief 删除下载文件 120 | */ 121 | /**** 122 | @brief Delete the downloaded file. 123 | */ 124 | - (void)deleteFile; 125 | 126 | /** 127 | @brief 获取下载config 128 | */ 129 | /**** 130 | @brief Query download config. 131 | */ 132 | - (AVDConfig*) getConfig; 133 | 134 | /** 135 | @brief 设置下载config 136 | */ 137 | /**** 138 | @brief Modify download config. 139 | */ 140 | - (void) setConfig:(AVDConfig*)config; 141 | 142 | /** 143 | @brief 设置下载的trackIndex 144 | @param trackIndex 从prepare回调中可以获取所有index 145 | */ 146 | /**** 147 | @brief Specify the indexes of the tracks to be downloaded. 148 | @param trackIndex Use the prepare callback to retrieve all track indexes. 149 | */ 150 | - (void) selectTrack:(int)trackIndex; 151 | 152 | /** 153 | @brief 设置转换播放的url的回调函数,一般用于p2p中的url地址转换 154 | @param callback 回调函数指针 155 | */ 156 | /**** 157 | @brief Set a URL conversion callback. URL conversion is typically used in P2P broadcasting. 158 | @param callback The function pointer of the callback. 159 | */ 160 | - (void) setPlayUrlConvertCallback:(PlayURLConverCallback)callback; 161 | 162 | /** 163 | @brief 设置代理,参考AMDDelegate 164 | */ 165 | /**** 166 | @brief Set a proxy. See AMDDelegate. 167 | */ 168 | @property (nonatomic, weak) id delegate; 169 | 170 | /** 171 | @brief 获取SDK版本号信息 172 | */ 173 | /**** 174 | @brief Query the SDK version. 175 | */ 176 | + (NSString*) getSDKVersion; 177 | 178 | /** 179 | @brief 获取下载之后的文件路径 180 | */ 181 | /**** 182 | @brief Query the path of the downloaded file. 183 | */ 184 | @property (nonatomic, readonly) NSString* downloadedFilePath; 185 | 186 | @end 187 | 188 | -------------------------------------------------------------------------------- /AliyunMediaDownloader.framework/Headers/AliyunMediaDownloader.h: -------------------------------------------------------------------------------- 1 | // 2 | // AliyunMediaDownloader.h 3 | // AliyunMediaDownloader 4 | // 5 | // Created by shiping.csp on 2019/2/25. 6 | // Copyright © 2019 shiping.csp. All rights reserved. 7 | // 8 | 9 | //#import 10 | //! Project version number for AliyunMediaDownloader. 11 | //FOUNDATION_EXPORT double AliyunMediaDownloaderVersionNumber; 12 | 13 | //! Project version string for AliyunMediaDownloader. 14 | //FOUNDATION_EXPORT const unsigned char AliyunMediaDownloaderVersionString[]; 15 | 16 | // In this header, you should import all the public headers of your framework using statements like #import 17 | 18 | #import 19 | -------------------------------------------------------------------------------- /AliyunMediaDownloader.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/AliyunMediaDownloader.framework/Info.plist -------------------------------------------------------------------------------- /AliyunMediaDownloader.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module AliyunMediaDownloader { 2 | umbrella header "AliyunMediaDownloader.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/AliyunPlayer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/AliyunPlayer.framework/AliyunPlayer -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AMDDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AMDDelegate.h 3 | // AliMediaDownloader 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #ifndef AMDDelegate_h 10 | #define AMDDelegate_h 11 | @class AVPMediaInfo; 12 | @class AVPErrorModel; 13 | 14 | @class AliMediaDownloader; 15 | 16 | #import 17 | 18 | @protocol AMDDelegate 19 | @optional 20 | 21 | /** 22 | @brief 下载准备完成事件回调 23 | @param downloader 下载downloader指针 24 | @param info 下载准备完成回调,@see AVPMediaInfo 25 | */ 26 | /**** 27 | @brief Download preparation completion callback. 28 | @param downloader Downloader pointer. 29 | @param info Download preparation completion callback. @see AVPMediaInfo 30 | */ 31 | -(void)onPrepared:(AliMediaDownloader*)downloader mediaInfo:(AVPMediaInfo*)info; 32 | 33 | /** 34 | @brief 错误代理回调 35 | @param downloader 下载downloader指针 36 | @param errorModel 播放器错误描述,参考AliVcPlayerErrorModel 37 | */ 38 | /**** 39 | @brief Proxy error callback. 40 | @param downloader Downloader pointer. 41 | @param errorModel Player error description. See AliVcPlayerErrorModel 42 | */ 43 | - (void)onError:(AliMediaDownloader*)downloader errorModel:(AVPErrorModel *)errorModel; 44 | 45 | /** 46 | @brief 下载进度回调 47 | @param downloader 下载downloader指针 48 | @param percent 下载进度 0-100 49 | */ 50 | /**** 51 | @brief Download progress callback. 52 | @param downloader Downloader pointer. 53 | @param percent Download progress: 0 to 100. 54 | */ 55 | - (void)onDownloadingProgress:(AliMediaDownloader*)downloader percentage:(int)percent; 56 | 57 | /** 58 | @brief 下载文件的处理进度回调 59 | @param downloader 下载downloader指针 60 | @param percent 下载进度 0-100 61 | */ 62 | /**** 63 | @brief Downloaded file processing progress callback. 64 | @param downloader Downloader pointer. 65 | @param percent Processing progress: 0 to 100. 66 | */ 67 | - (void)onProcessingProgress:(AliMediaDownloader*)downloader percentage:(int)percent; 68 | 69 | /** 70 | @brief 下载完成回调 71 | @param downloader 下载downloader指针 72 | */ 73 | /**** 74 | @brief Download completion callback. 75 | @param downloader Downloader pointer. 76 | */ 77 | - (void)onCompletion:(AliMediaDownloader*)downloader; 78 | 79 | @end 80 | 81 | #endif /* AMDDelegate_h */ 82 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AVPCacheConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // AVPCacheConfig.h 3 | // AliPlayerSDK 4 | // 5 | // Created by huang_jiafa on 2019/05/31. 6 | // Copyright (c) 2019 Aliyun. All rights reserved. 7 | // 8 | 9 | #ifndef AVPCacheConfig_h 10 | #define AVPCacheConfig_h 11 | 12 | #import 13 | 14 | OBJC_EXPORT 15 | @interface AVPCacheConfig : NSObject 16 | 17 | /** 18 | @brief 缓存目录 19 | */ 20 | /**** 21 | @brief The cache directory. 22 | */ 23 | @property (nonatomic, copy) NSString *path; 24 | 25 | /** 26 | @brief 单个视频缓存的最大时长,单位秒,即某个视频的时长超过maxDuration将不会被缓存 27 | */ 28 | /**** 29 | @brief The maximum length of a single video that can be cached. Unit: seconds. Videos that exceed the maximum length are not cached. 30 | */ 31 | @property (nonatomic, assign) long maxDuration; 32 | 33 | /** 34 | @brief 所有缓存最大占用空间,单位:MB 35 | */ 36 | /**** 37 | @brief The maximum cache memory size. Unit: MB. 38 | */ 39 | @property (nonatomic, assign) int maxSizeMB; 40 | 41 | /** 42 | @brief 是否开启缓存。默认关闭。 43 | */ 44 | /**** 45 | @brief Enable or disable content caching. Default: disabled. 46 | */ 47 | @property (nonatomic, assign) BOOL enable; 48 | 49 | @end 50 | 51 | #endif /* AVPCacheConfig_h */ 52 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AVPConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // AVPConfig.h 3 | // AliPlayerSDK 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #ifndef AVPConfig_h 10 | #define AVPConfig_h 11 | 12 | #import 13 | 14 | OBJC_EXPORT 15 | @interface AVPConfig : NSObject 16 | 17 | /** 18 | @brief 直播最大延迟 默认5000毫秒,单位毫秒 19 | */ 20 | /**** 21 | @brief The maximum broadcasting delay. Default: 5000 milliseconds, Unit: millisecond. 22 | */ 23 | @property (nonatomic, assign) int maxDelayTime; 24 | 25 | /** 26 | @brief 卡顿后缓存数据的高水位,当播放器缓存数据大于此值时开始播放,单位毫秒 27 | */ 28 | /**** 29 | @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. 30 | */ 31 | @property (nonatomic, assign) int highBufferDuration; 32 | 33 | /** 34 | @brief 开始起播缓存区数据长度,默认500ms,单位毫秒 35 | */ 36 | /**** 37 | @brief The size of the cache data required for starting playback. Default: 500 milliseconds, Unit: millisecond. 38 | */ 39 | @property (nonatomic, assign) int startBufferDuration; 40 | 41 | /** 42 | @brief 播放器最大的缓存数据长度,默认50秒,单位毫秒 43 | */ 44 | /**** 45 | @brief The maximum size of cache data. Default: 50 seconds, Unit: millisecond. 46 | */ 47 | @property (nonatomic, assign) int maxBufferDuration; 48 | 49 | /** 50 | @brief 网络超时时间,默认15秒,单位毫秒 51 | */ 52 | /**** 53 | @brief Network connection timeout time. Default: 15 seconds, Unit: millisecond. 54 | */ 55 | @property (nonatomic, assign) int networkTimeout; 56 | 57 | /** 58 | @brief 网络重试次数,每次间隔networkTimeout,networkRetryCount=0则表示不重试,重试策略app决定,默认值为2 59 | */ 60 | /**** 61 | @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. 62 | */ 63 | @property (nonatomic, assign) int networkRetryCount; 64 | 65 | /** 66 | @brief probe数据大小,默认-1,表示不设置 67 | */ 68 | /**** 69 | @brief The size of the probe data. Default: -1. Value -1 indicates that the probe data size is not specified. */ 70 | @property (nonatomic, assign) int maxProbeSize; 71 | 72 | /** 73 | @brief 请求referer 74 | */ 75 | /**** 76 | @brief Request Referer. 77 | */ 78 | @property (nonatomic, copy) NSString *referer; 79 | 80 | /** 81 | @brief user Agent 82 | */ 83 | /**** 84 | @brief UserAgent. 85 | */ 86 | @property (nonatomic, copy) NSString *userAgent; 87 | 88 | /** 89 | @brief httpProxy代理 90 | */ 91 | /**** 92 | @brief HTTP proxy. 93 | */ 94 | @property (nonatomic, copy) NSString *httpProxy; 95 | 96 | /** 97 | @brief 调用stop停止后是否显示最后一帧图像,YES代表清除显示,黑屏,默认为NO 98 | */ 99 | /**** 100 | @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. 101 | */ 102 | @property (nonatomic, assign) BOOL clearShowWhenStop; 103 | 104 | /** 105 | @brief 添加自定义header 106 | */ 107 | /**** 108 | @brief Add a custom header. 109 | */ 110 | @property (nonatomic, copy) NSMutableArray *httpHeaders; 111 | 112 | /** 113 | @brief 是否启用SEI 114 | */ 115 | /**** 116 | @brief Enable or disable SEI. 117 | */ 118 | @property (nonatomic, assign) BOOL enableSEI; 119 | 120 | /** 121 | @brief 是否开启本地缓存 122 | */ 123 | /**** 124 | @brief Enable or disable local cache. 125 | */ 126 | @property(nonatomic, assign) BOOL enableLocalCache; 127 | 128 | /* set the video format for renderFrame callback 129 | * vtb decoder only, equal to OSType, not be supported by other decoder 130 | * support 420v 420f y420 BGRA 131 | * */ 132 | @property (nonatomic, assign) int pixelBufferOutputFormat; 133 | /** 134 | @brief HLS直播时,起播分片位置。 135 | */ 136 | /**** 137 | @brief The start playing index of fragments, when HLS is live. 138 | */ 139 | @property(nonatomic, assign) int liveStartIndex; 140 | /** 141 | @brief 禁用Audio. 142 | */ 143 | /**** 144 | @brief Disable audio track. 145 | */ 146 | @property (nonatomic, assign) BOOL disableAudio; 147 | 148 | /** 149 | @brief 禁用Video 150 | */ 151 | /**** 152 | @brief Disable video track. 153 | */ 154 | @property (nonatomic, assign) BOOL disableVideo; 155 | 156 | /** 157 | @brief 进度跟新的频率。包括当前位置和缓冲位置。 158 | */ 159 | /**** 160 | @brief Set the frequencies of Progress. Includes the current position and the buffer position. 161 | */ 162 | @property(nonatomic, assign) int positionTimerIntervalMs; 163 | 164 | /** 165 | @brief 设置播放器后向buffer的最大值. 166 | */ 167 | /**** 168 | @brief set the maximum backward buffer duration of the player. 169 | */ 170 | @property(nonatomic, assign) uint64_t mMAXBackwardDuration; 171 | 172 | 173 | /** 174 | @brief 优先保证音频播放;在网络带宽不足的情况下,优先保障音频的播放,目前只在dash直播流中有效(视频已经切换到了最低码率) 175 | */ 176 | /**** 177 | @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) 178 | */ 179 | @property (nonatomic, assign) BOOL preferAudio; 180 | 181 | /** 182 | @brief 播放器实例是否可以使用http dns进行解析,-1 表示跟随全局设置,0 disable 183 | */ 184 | /**** 185 | @brief whether enable http dns, -1 : as globel setting 186 | */ 187 | @property(nonatomic, assign) int enableHttpDns; 188 | 189 | @end 190 | 191 | #endif /* AVPConfig_h */ 192 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AVPDef.h: -------------------------------------------------------------------------------- 1 | // 2 | // AVPDef.h 3 | // AVPSDK 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #ifndef AVPDef_h 10 | #define AVPDef_h 11 | 12 | #import 13 | 14 | #if TARGET_OS_OSX 15 | #import 16 | #define AVPView NSView 17 | #define AVPImage NSImage 18 | #elif TARGET_OS_IPHONE 19 | #import 20 | #define AVPView UIView 21 | #define AVPImage UIImage 22 | #endif // TARGET_OS_OSX 23 | 24 | #import "AVPErrorCode.h" 25 | 26 | /** 27 | * Convert playback URL before playback. 28 | * 29 | * For vid playback, try to convert the playback URL before playback 30 | * 31 | * @param srcURL [in] input URL. 32 | * @param srcFormat [in] input format. should be "m3u8" "mp4", or "" if unknown. 33 | * @param destURL [out] output URL, convertURL function will malloc the memory, and user of PlayURLConverCallback need free it outside. 34 | * 35 | * @return true if success. 36 | */ 37 | typedef bool (*PlayURLConverCallback)(const char* srcURL, const char* srcFormat, char** destURL); 38 | 39 | 40 | typedef enum AVPStatus: NSUInteger { 41 | /** @brief 空转,闲时,静态 */ 42 | /**** @brief Idle */ 43 | AVPStatusIdle = 0, 44 | /** @brief 初始化完成 */ 45 | /**** @brief Initialized */ 46 | AVPStatusInitialzed, 47 | /** @brief 准备完成 */ 48 | /**** @brief Prepared */ 49 | AVPStatusPrepared, 50 | /** @brief 正在播放 */ 51 | /**** @brief Playing */ 52 | AVPStatusStarted, 53 | /** @brief 播放暂停 */ 54 | /**** @brief Paused */ 55 | AVPStatusPaused, 56 | /** @brief 播放停止 */ 57 | /**** @brief Stopped */ 58 | AVPStatusStopped, 59 | /** @brief 播放完成 */ 60 | /**** @brief Completed */ 61 | AVPStatusCompletion, 62 | /** @brief 播放错误 */ 63 | /**** @brief Error */ 64 | AVPStatusError 65 | } AVPStatus; 66 | 67 | /**@brief 跳转模式,是否为精准跳转*/ 68 | /****@brief Seeking mode: accurate seeking or inaccurate seeking.*/ 69 | typedef enum AVPSeekMode: NSUInteger { 70 | AVP_SEEKMODE_ACCURATE = 0x01, 71 | AVP_SEEKMODE_INACCURATE = 0x10, 72 | } AVPSeekMode; 73 | 74 | /**@brief 渲染显示模式*/ 75 | /****@brief Zoom mode*/ 76 | typedef enum AVPScalingMode: NSUInteger { 77 | /**@brief 不保持比例平铺*/ 78 | /****@brief Auto stretch to fit.*/ 79 | AVP_SCALINGMODE_SCALETOFILL, 80 | /**@brief 保持比例,黑边*/ 81 | /****@brief Keep aspect ratio and add black borders.*/ 82 | AVP_SCALINGMODE_SCALEASPECTFIT, 83 | /**@brief 保持比例填充,需裁剪*/ 84 | /****@brief Keep aspect ratio and crop.*/ 85 | AVP_SCALINGMODE_SCALEASPECTFILL, 86 | } AVPScalingMode; 87 | 88 | /**@brief 旋转模式*/ 89 | /****@brief Rotate mode*/ 90 | typedef enum AVPRotateMode: NSUInteger { 91 | AVP_ROTATE_0 = 0, 92 | AVP_ROTATE_90 = 90, 93 | AVP_ROTATE_180 = 180, 94 | AVP_ROTATE_270 = 270 95 | } AVPRotateMode; 96 | 97 | /**@brief 镜像模式*/ 98 | /****@brief Mirroring mode*/ 99 | typedef enum AVPMirrorMode: NSUInteger { 100 | AVP_MIRRORMODE_NONE, 101 | AVP_MIRRORMODE_HORIZONTAL, 102 | AVP_MIRRORMODE_VERTICAL, 103 | } AVPMirrorMode; 104 | 105 | /**@brief 播放器事件类型*/ 106 | /****@brief Player event type*/ 107 | typedef enum AVPEventType: NSUInteger { 108 | /**@brief 准备完成事件*/ 109 | /****@brief Preparation completion event*/ 110 | AVPEventPrepareDone, 111 | /**@brief 自动启播事件*/ 112 | /****@brief Autoplay start event*/ 113 | AVPEventAutoPlayStart, 114 | /**@brief 首帧显示事件*/ 115 | /****@brief First frame display event*/ 116 | AVPEventFirstRenderedStart, 117 | /**@brief 播放完成事件*/ 118 | /****@brief Playback completion event*/ 119 | AVPEventCompletion, 120 | /**@brief 缓冲开始事件*/ 121 | /****@brief Buffer start event*/ 122 | AVPEventLoadingStart, 123 | /**@brief 缓冲完成事件*/ 124 | /****@brief Buffer completion event*/ 125 | AVPEventLoadingEnd, 126 | /**@brief 跳转完成事件*/ 127 | /****@brief Seeking completion event*/ 128 | AVPEventSeekEnd, 129 | /**@brief 循环播放开始事件*/ 130 | /****@brief Loop playback start event*/ 131 | AVPEventLoopingStart, 132 | } AVPEventType; 133 | 134 | /**@brief 获取信息播放器的key*/ 135 | /****@brief The key to get property*/ 136 | typedef enum AVPPropertyKey: NSUInteger { 137 | /**@brief Http的response信息 138 | * 返回的字符串是JSON数组,每个对象带response和type字段。type字段可以是url/video/audio/subtitle,根据流是否有相应Track返回。 139 | * 例如:[{"response":"response string","type":"url"},{"response":"","type":"video"}] 140 | */ 141 | /****@brief Http response info 142 | * Return with JSON array,each object item include 'response'/'type' filed。'type' could be url/video/audio/subtitle, depend on the stream whether have the tracks。 143 | * For example: [{"response":"response string","type":"url"},{"response":"","type":"video"}] 144 | */ 145 | AVP_KEY_RESPONSE_INFO = 0, 146 | 147 | /**@brief 主URL的连接信息 148 | * 返回的字符串是JSON对象,带url/ip/eagleID/cdnVia/cdncip/cdnsip等字段(如果解析不到则不添加) 149 | * 例如:{"url":"http://xxx","openCost":23,"ip":"11.111.111.11","cdnVia":"xxx","cdncip":"22.222.222.22","cdnsip":"xxx"} 150 | */ 151 | /****@brief Major URL connect information 152 | * Return with JSON object,include sub fileds such as url/ip/eagleID/cdnVia/cdncip/cdnsip. 153 | * For example: {"url":"http://xxx","openCost":23,"ip":"11.111.111.11","cdnVia":"xxx","cdncip":"22.222.222.22","cdnsip":"xxx"} 154 | */ 155 | AVP_KEY_CONNECT_INFO = 1, 156 | } AVPPropertyKey; 157 | 158 | /**@brief IP 解析类型*/ 159 | /**@brief IP resolve type*/ 160 | typedef enum AVPIpResolveType: NSUInteger { 161 | AVPIpResolveWhatEver, 162 | AVPIpResolveV4, 163 | AVPIpResolveV6, 164 | } AVPIpResolveType; 165 | 166 | typedef enum AVPOption : NSUInteger { 167 | /** 168 | * @brief 渲染的fps。类型为Float 169 | */ 170 | /**** 171 | * @brief render fps. Return value type is Float 172 | */ 173 | AVP_OPTION_RENDER_FPS = 0, 174 | 175 | /** 176 | * 当前的网络下行码率。类型为Float 177 | */ 178 | /**** 179 | * current download bitrate. Return value type is Float 180 | */ 181 | AVP_OPTION_DOWNLOAD_BITRATE = 1, 182 | 183 | /** 184 | * 当前播放的视频码率。类型为Float 185 | */ 186 | /**** 187 | * current playback video bitrate. Return value type is Float 188 | */ 189 | AVP_OPTION_VIDEO_BITRATE = 2, 190 | 191 | /** 192 | * 当前播放的音频码率。类型为Float 193 | */ 194 | /**** 195 | * current playback audio bitrate. Return value type is Float 196 | */ 197 | AVP_OPTION_AUDIO_BITRATE = 3, 198 | } AVPOption; 199 | 200 | /** 201 | @brief AVPErrorModel为播放错误信息描述 202 | */ 203 | /**** 204 | @brief AVPErrorModel represents playback error descriptions. 205 | */ 206 | OBJC_EXPORT 207 | @interface AVPErrorModel : NSObject 208 | 209 | /** 210 | @brief code为播放错误信息code 211 | */ 212 | /**** 213 | @brief code represents a playback error code. 214 | */ 215 | @property (nonatomic, assign) AVPErrorCode code; 216 | 217 | /** 218 | @brief message为播放错误信息描述 219 | */ 220 | /**** 221 | @brief message represents a playback error message. 222 | */ 223 | @property (nonatomic, copy) NSString *message; 224 | 225 | /** 226 | @brief requestId为播放错误信息requestID 227 | */ 228 | /**** 229 | @brief requestId represents the request ID of a playback error. 230 | */ 231 | @property (nonatomic, copy) NSString *requestId; 232 | 233 | /** 234 | @brief videoId为播放错误发生的videoID 235 | */ 236 | /**** 237 | @brief videoId represents the VID of the video that has a playback error. 238 | */ 239 | @property (nonatomic, copy) NSString *videoId; 240 | 241 | @end 242 | 243 | 244 | /** 245 | @brief AVPTimeShiftModel直播时移描述 246 | */ 247 | /**** 248 | @brief AVPTimeShiftModel represents broadcasting timeshift descriptions. 249 | */ 250 | OBJC_EXPORT 251 | @interface AVPTimeShiftModel : NSObject 252 | 253 | /** 254 | @brief startTime直播时移开始时间 255 | */ 256 | /**** 257 | @brief startTime represents the start of the time range for broadcasting timeshift. 258 | */ 259 | @property (nonatomic, assign) NSTimeInterval startTime; 260 | 261 | /** 262 | @brief endTime直播时移结束时间 263 | */ 264 | /**** 265 | @brief endTime represents the end of the time range for broadcasting timeshift. 266 | */ 267 | @property (nonatomic, assign) NSTimeInterval endTime; 268 | 269 | /** 270 | @brief currentTime直播时移当前时间 271 | */ 272 | /**** 273 | @brief currentTime represents the time that broadcasting timeshift seeks to. 274 | */ 275 | @property (nonatomic, assign) NSTimeInterval currentTime; 276 | @end 277 | 278 | /** 279 | @brief logLevel 280 | */ 281 | typedef enum AVPLogLevel: NSUInteger { 282 | LOG_LEVEL_NONE = 0, 283 | LOG_LEVEL_FATAL = 8, 284 | LOG_LEVEL_ERROR = 16, 285 | LOG_LEVEL_WARNING = 24, 286 | LOG_LEVEL_INFO = 32, 287 | LOG_LEVEL_DEBUG = 48, 288 | LOG_LEVEL_TRACE = 56, 289 | } AVPLogLevel; 290 | 291 | typedef enum _AVPStsStatus { 292 | Valid, 293 | Invalid, 294 | Pending } AVPStsStatus; 295 | 296 | typedef struct _AVPStsInfo { 297 | NSString *accId; 298 | NSString *accSecret; 299 | NSString *token; 300 | NSString *region; 301 | NSString *formats; 302 | } AVPStsInfo; 303 | 304 | /** 305 | @brief 是否支持的功能的类型 306 | */ 307 | /**** 308 | @brief The type of the feature. 309 | */ 310 | typedef enum _SupportFeatureType : NSUInteger { 311 | /** 312 | * 硬件是否支持杜比音频 313 | */ 314 | /**** 315 | * whether the device support Dolby Audio. 316 | */ 317 | FeatureDolbyAudio 318 | } SupportFeatureType; 319 | 320 | 321 | #endif /* AVPDef_h */ 322 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AVPDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AVPDelegate.h 3 | // AliPlayerSDK 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #ifndef AVPDelegate_h 10 | #define AVPDelegate_h 11 | 12 | @class AliPlayer; 13 | @class AVPTrackInfo; 14 | 15 | #import 16 | #import "AVPDef.h" 17 | 18 | @protocol AVPDelegate 19 | @optional 20 | 21 | /** 22 | @brief 播放器事件回调 23 | @param player 播放器player指针 24 | @param eventType 播放器事件类型 25 | @see AVPEventType 26 | */ 27 | /**** 28 | @brief Player event callback. 29 | @param player Player pointer. 30 | @param eventType Player event type. 31 | @see AVPEventType 32 | */ 33 | -(void)onPlayerEvent:(AliPlayer*)player eventType:(AVPEventType)eventType; 34 | 35 | /** 36 | @brief 播放器事件回调 37 | @param player 播放器player指针 38 | @param eventWithString 播放器事件类型 39 | @param description 播放器事件说明 40 | @see AVPEventType 41 | */ 42 | /**** 43 | @brief Player event callback. 44 | @param player Player pointer. 45 | @param eventWithString Player event type. 46 | @param description Player event description. 47 | @see AVPEventType 48 | */ 49 | -(void)onPlayerEvent:(AliPlayer*)player eventWithString:(AVPEventWithString)eventWithString description:(NSString *)description; 50 | 51 | /** 52 | @brief 错误代理回调 53 | @param player 播放器player指针 54 | @param errorModel 播放器错误描述,参考AVPErrorModel 55 | @see AVPErrorModel 56 | */ 57 | /**** 58 | @brief Proxy error callback. 59 | @param player Player pointer. 60 | @param errorModel Player error description. See AVPErrorModel. 61 | @see AVPErrorModel 62 | */ 63 | - (void)onError:(AliPlayer*)player errorModel:(AVPErrorModel *)errorModel; 64 | 65 | /** 66 | @brief 视频大小变化回调 67 | @param player 播放器player指针 68 | @param width 视频宽度 69 | @param height 视频高度 70 | @param rotation 视频旋转角度 71 | */ 72 | /**** 73 | @brief Video size change callback. 74 | @param player Player pointer. 75 | @param width Video width. 76 | @param height Video height. 77 | @param rotation Video rotate angle. 78 | */ 79 | - (void)onVideoSizeChanged:(AliPlayer*)player width:(int)width height:(int)height rotation:(int)rotation; 80 | 81 | /** 82 | @brief 视频当前播放位置回调 83 | @param player 播放器player指针 84 | @param position 视频当前播放位置 85 | */ 86 | /**** 87 | @brief Current playback position callback. 88 | @param player Player pointer. 89 | @param position Current playback position. 90 | */ 91 | - (void)onCurrentPositionUpdate:(AliPlayer*)player position:(int64_t)position; 92 | 93 | /** 94 | @brief 视频当前播放内容对应的utc时间回调 95 | @param player 播放器player指针 96 | @param time utc时间 97 | */ 98 | /**** 99 | @brief Current playback utc time callback. 100 | @param player Player pointer. 101 | @param position Current utc time. 102 | */ 103 | 104 | - (void)onCurrentUtcTimeUpdate:(AliPlayer *)player time:(int64_t)time; 105 | 106 | /** 107 | @brief 视频当前播放缓存命中回调 108 | @param player 播放器player指针 109 | @param size 文件大小 110 | */ 111 | /**** 112 | @brief Current playback cached file size callback. 113 | @param player Player pointer. 114 | @param size file size. 115 | */ 116 | - (void)onLocalCacheLoaded:(AliPlayer *)player size:(int64_t)size; 117 | 118 | /** 119 | @brief 视频缓存位置回调 120 | @param player 播放器player指针 121 | @param position 视频当前缓存位置 122 | */ 123 | /**** 124 | @brief Current cache position callback. 125 | @param player Player pointer. 126 | @param position Current cache position. 127 | */ 128 | - (void)onBufferedPositionUpdate:(AliPlayer*)player position:(int64_t)position; 129 | 130 | /** 131 | @brief 视频缓冲进度回调 132 | @param player 播放器player指针 133 | @param progress 缓存进度0-100 134 | */ 135 | /**** 136 | @brief Buffer progress callback. 137 | @param player Player pointer. 138 | @param progress Buffer progress: from 0 to 100. 139 | */ 140 | - (void)onLoadingProgress:(AliPlayer*)player progress:(float)progress; 141 | 142 | 143 | /** 144 | @brief 当前下载速度回调 145 | @param player 播放器player指针 146 | @param speed bits per second 147 | */ 148 | /**** 149 | @brief current download speed callback. 150 | @param player Player pointer. 151 | @param speed bits per second. 152 | */ 153 | 154 | - (void)onCurrentDownloadSpeed:(AliPlayer *)player speed:(int64_t)speed; 155 | 156 | /** 157 | @brief 获取track信息回调 158 | @param player 播放器player指针 159 | @param info track流信息数组 160 | @see AVPTrackInfo 161 | */ 162 | /**** 163 | @brief Track information callback. 164 | @param player Player pointer. 165 | @param info An array of track information. 166 | @see AVPTrackInfo 167 | */ 168 | - (void)onTrackReady:(AliPlayer*)player info:(NSArray*)info; 169 | 170 | /** 171 | @brief 选择希望播放的流 172 | @param player 播放器player指针 173 | @param info track流信息数组 174 | @see AVPTrackInfo 175 | */ 176 | - (int)onChooseTrackIndex:(AliPlayer *)player info:(NSArray *)info; 177 | 178 | /** 179 | @brief track切换完成回调 180 | @param player 播放器player指针 181 | @param info 切换后的信息 参考AVPTrackInfo 182 | @see AVPTrackInfo 183 | */ 184 | /**** 185 | @brief Track switchover completion callback. 186 | @param player Player pointer. 187 | @param info Track switchover completion information. See AVPTrackInfo. 188 | @see AVPTrackInfo 189 | */ 190 | - (void)onTrackChanged:(AliPlayer*)player info:(AVPTrackInfo*)info; 191 | 192 | /** 193 | @brief 外挂字幕被添加 194 | @param player 播放器player指针 195 | @param index 字幕显示的索引号 196 | @param URL 字幕url 197 | */ 198 | /**** 199 | @brief External subtitles have been added 200 | @param player Player pointer. 201 | @param trackIndex Subtitle index. 202 | @param URL subtitle url 203 | */ 204 | - (void)onSubtitleExtAdded:(AliPlayer*)player trackIndex:(int)trackIndex URL:(NSString *)URL; 205 | 206 | 207 | /** 208 | @brief 字幕头信息回调,ass字幕,如果实现了此回调,则播放器不会渲染字幕,由调用者完成渲染,否则播放器自动完成字幕的渲染 209 | @param player 播放器player指针 210 | @param index 字幕显示的索引号 211 | @param header 头内容 212 | */ 213 | /**** 214 | @brief subtitle header info callback, 215 | for ass, player will not render the subtitle when this is implemented by user 216 | @param player Player pointer. 217 | @param trackIndex Subtitle index. 218 | @param URL subtitle url 219 | */ 220 | - (void)onSubtitleHeader:(AliPlayer *)player trackIndex:(int)trackIndex Header:(NSString *)header; 221 | 222 | /** 223 | @brief 字幕显示回调 224 | @param player 播放器player指针 225 | @param trackIndex 字幕流索引. 226 | @param subtitleID 字幕ID. 227 | @param subtitle 字幕显示的字符串 228 | */ 229 | /**** 230 | @brief Show subtitle callback. 231 | @param player Player pointer. 232 | @param trackIndex Subtitle stream index. 233 | @param subtitleID Subtitle ID. 234 | @param subtitle Subtitle string. 235 | */ 236 | - (void)onSubtitleShow:(AliPlayer*)player trackIndex:(int)trackIndex subtitleID:(long)subtitleID subtitle:(NSString *)subtitle; 237 | 238 | /** 239 | @brief 字幕隐藏回调 240 | @param player 播放器player指针 241 | @param trackIndex 字幕流索引. 242 | @param subtitleID 字幕ID. 243 | */ 244 | /**** 245 | @brief Hide subtitle callback. 246 | @param player Player pointer. 247 | @param trackIndex Subtitle stream index. 248 | @param subtitleID Subtitle ID. 249 | */ 250 | - (void)onSubtitleHide:(AliPlayer*)player trackIndex:(int)trackIndex subtitleID:(long)subtitleID; 251 | 252 | /** 253 | @brief 获取缩略图成功回调 254 | @param positionMs 指定的缩略图位置 255 | @param fromPos 此缩略图的开始位置 256 | @param toPos 此缩略图的结束位置 257 | @param image 缩图略图像指针,对于mac是NSImage,iOS平台是UIImage指针 258 | */ 259 | /**** 260 | @brief Thumbnail image retrieval success callback. 261 | @param positionMs The specified thumbnail image position. 262 | @param fromPos The initial position of the thumbnail image. 263 | @param toPos The end position of the thumbnail image. 264 | @param image Thumbnail image pointer. Mac: NSImage. iOS: UIImage. 265 | */ 266 | - (void)onGetThumbnailSuc:(int64_t)positionMs fromPos:(int64_t)fromPos toPos:(int64_t)toPos image:(id)image; 267 | 268 | /** 269 | @brief 获取缩略图失败回调 270 | @param positionMs 指定的缩略图位置 271 | */ 272 | /**** 273 | @brief Thumbnail image retrieval failure callback. 274 | @param positionMs The specified thumbnail image position. 275 | */ 276 | - (void)onGetThumbnailFailed:(int64_t)positionMs; 277 | 278 | /** 279 | @brief 播放器状态改变回调 280 | @param player 播放器player指针 281 | @param oldStatus 老的播放器状态 参考AVPStatus 282 | @param newStatus 新的播放器状态 参考AVPStatus 283 | @see AVPStatus 284 | */ 285 | /**** 286 | @brief Player status update callback. 287 | @param player Player pointer. 288 | @param oldStatus The previous status. See AVPStatus. 289 | @param newStatus The updated status. See AVPStatus. 290 | @see AVPStatus 291 | */ 292 | - (void)onPlayerStatusChanged:(AliPlayer*)player oldStatus:(AVPStatus)oldStatus newStatus:(AVPStatus)newStatus; 293 | 294 | /** 295 | @brief 获取截图回调 296 | @param player 播放器player指针 297 | @param image 图像 298 | @see AVPImage 299 | */ 300 | /**** 301 | @brief Snapshot retrieval callback. 302 | @param player Player pointer. 303 | @param image Snapshot. 304 | @see AVPImage 305 | */ 306 | - (void)onCaptureScreen:(AliPlayer*)player image:(AVPImage*)image; 307 | 308 | /** 309 | @brief SEI回调 310 | @param player 播放器player指针 311 | @param type 类型 312 | @param data 数据 313 | @see AVPImage 314 | */ 315 | /**** 316 | @brief SEI callback. 317 | @param player Player pointer. 318 | @param type Type. 319 | @param data Data. 320 | @see AVPImage 321 | */ 322 | - (void)onSEIData:(AliPlayer*)player type:(int)type data:(NSData *)data; 323 | 324 | /** 325 | @brief 播放器渲染信息回调 326 | @param player 播放器player指针 327 | @param timeMs 渲染时的系统时间 328 | @param pts 视频帧pts 329 | */ 330 | /**** 331 | @brief Player render info callback. 332 | @param player Player pointer. 333 | @param timeMs system time when render. 334 | @param pts video frame pts 335 | @see AVPEventType 336 | */ 337 | -(void)onVideoRendered:(AliPlayer*)player timeMs:(int64_t)timeMs pts:(int64_t)pts; 338 | 339 | @end 340 | 341 | /** 342 | @brief 埋点事件参数回调 343 | */ 344 | /**** 345 | @brief Event report params 346 | */ 347 | @protocol AVPEventReportParamsDelegate 348 | /** 349 | @brief 回调 350 | @param params 埋点事件参数 351 | */ 352 | /**** 353 | @brief call back 354 | @param params event params 355 | */ 356 | -(void)onEventReportParams:(NSDictionary*)params; 357 | @end 358 | #endif /* AVPDelegate_h */ 359 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AVPErrorCode.h: -------------------------------------------------------------------------------- 1 | #ifndef AVPErrorCode_h 2 | #define AVPErrorCode_h 3 | 4 | typedef enum AVPErrorCode: NSUInteger { 5 | /**@brief 服务器返回数据为空。*/ 6 | /****@brief The server returns no response.*/ 7 | ERROR_SERVER_NO_RESPONSE = 0x20010001, 8 | /**@brief 服务器返回数据不为json格式。*/ 9 | /****@brief The response returned by the server is not in JSON format.*/ 10 | ERROR_SERVER_WRONG_JSON = 0x20010002, 11 | /**@brief 没有找到匹配的清晰度。*/ 12 | /****@brief No resolution matching the request is available.*/ 13 | ERROR_NO_MATCH_QUALITY = 0x20010003, 14 | /**@brief PlayAuth解析错误。*/ 15 | /****@brief A playAuth parsing error has occurred.*/ 16 | ERROR_PLAYAUTH_WRONG = 0x20010004, 17 | /**@brief 请求失败。*/ 18 | /****@brief The request failed.*/ 19 | ERROR_REQUEST_FAIL = 0x20010005, 20 | /**@brief 服务端返回播放信息为空。*/ 21 | /****@brief The server returns no playback information. */ 22 | ERROR_NO_PLAY_INFO = 0x20010006, 23 | 24 | //------------------ POP begin ------------------------ 25 | /**@brief POP未知错误。*/ 26 | /****@brief An unknown POP error has occurred. */ 27 | ERROR_SERVER_POP_UNKNOWN = 0x20010100, 28 | /**@brief 缺少参数。*/ 29 | /****@brief A parameter is missing.*/ 30 | ERROR_SERVER_POP_MISSING_PARAMETER = 0x20010101, 31 | /**@brief 参数无效。*/ 32 | /****@brief A parameter is invalid.*/ 33 | ERROR_SERVER_POP_INVALID_PARAMETER = 0x20010102, 34 | /**@brief 账号未开通视频点播服务。*/ 35 | /****@brief ApsaraVideo for VOD has not been activated for your account.*/ 36 | ERROR_SERVER_POP_OPERATION_DENIED = 0x20010103, 37 | /**@brief 账号已欠费,请充值。*/ 38 | /****@brief Your account has overdue payments. Recharge your account.*/ 39 | ERROR_SERVER_POP_OPERATION_SUSPENED = 0x20010104, 40 | /**@brief 无权限执行该操作。*/ 41 | /****@brief You are not authorized to perform the operation.*/ 42 | ERROR_SERVER_POP_FORBIDDEN = 0x20010105, 43 | /**@brief 后台发生未知错误。*/ 44 | /****@brief An unknown error has occurred in the background.*/ 45 | ERROR_SERVER_POP_INTERNAL_ERROR = 0x20010106, 46 | /**@brief 服务不可用。*/ 47 | /****@brief The service is unavailable.*/ 48 | ERROR_SERVER_POP_SERVICE_UNAVALIABLE = 0x20010107, 49 | /**@brief 签名已经被使用。*/ 50 | /****@brief The signature has been used.*/ 51 | ERROR_SERVER_POP_SIGNATUREANONCE_USED = 0x20010108, 52 | /**@brief 安全token不对。*/ 53 | /****@brief The security token is incorrect.*/ 54 | ERROR_SERVER_POP_SECURITYTOKEN_MAILFORMED = 0x20010109, 55 | /**@brief 安全token与Accesskey不匹配。*/ 56 | /****@brief The security token and AccessKey do not match.*/ 57 | ERROR_SERVER_POP_SECURITYTOKEN_MISMATCH_ACCESSKEY = 0x2001010A, 58 | /**@brief 签名校验不对。*/ 59 | /****@brief The signature is incorrect.*/ 60 | ERROR_SERVER_POP_SIGNATURE_NOT_MATCH = 0x2001010B, 61 | /**@brief 没有找到AccessKeyId。*/ 62 | /****@brief The AccessKey ID does not exist.*/ 63 | ERROR_SERVER_POP_ACCESSKEYID_NOT_FOUND = 0x2001010C, 64 | /**@brief Token过期。*/ 65 | /****@brief The token is expired.*/ 66 | ERROR_SERVER_POP_TOKEN_EXPIRED = 0x2001010D, 67 | 68 | //------------------ VOD begin ------------------------ 69 | /**@brief VOD未知错误。*/ 70 | /****@brief An unknown VOD error has occurred.*/ 71 | ERROR_SERVER_VOD_UNKNOWN = 0x20010200, 72 | /**@brief 视频状态无效。*/ 73 | /****@brief The video status is invalid.*/ 74 | ERROR_SERVER_VOD_FORBIDDEN_ILLEGALSTATUS = 0x20010201, 75 | /**@brief 视频不存在。*/ 76 | /****@brief The specified video does not exist.*/ 77 | ERROR_SERVER_VOD_INVALIDVIDEO_NOTFOUND = 0x20010202, 78 | /**@brief 根据您的筛选条件找不到可以播放的转码输出流。*/ 79 | /****@brief No transcoded stream file available for playback is found based on the specified filter criteria.*/ 80 | ERROR_SERVER_VOD_INVALIDVIDEO_NOSTREAM = 0x20010203, 81 | /**@brief 当前仅存在阿里云视频加密的转码输出流,必须使用阿里云播放器进行播放或者设置请求参数ResultType值为Multiple。*/ 82 | /****@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.*/ 83 | ERROR_SERVER_VOD_FORBIDDEN_ALIYUNVODENCRYPTION = 0x20010204, 84 | /**@brief AuthInfo与vid不一致。*/ 85 | /****@brief The authentication information and the video ID (VID) do not match.*/ 86 | ERROR_SERVER_VOD_INVALIDAUTH_MEDIAID = 0x20010205, 87 | /**@brief AuthInfo过期。*/ 88 | /****@brief The authentication information has expired.*/ 89 | ERROR_SERVER_VOD_INVALIDAUTHINFO_EXPIRETIME = 0x20010206, 90 | 91 | //------------------ MPS begin ------------------------ 92 | /**@brief MPS未知错误。*/ 93 | /****@brief An unknown ApsaraVideo for Media Processing (MPS) error has occurred.*/ 94 | ERROR_SERVER_MPS_UNKNOWN = 0x20010300, 95 | /**@brief MediaId无效。*/ 96 | /****@brief The media ID is invalid.*/ 97 | ERROR_SERVER_MPS_INVALID_MEDIAID = 0x20010301, 98 | /**@brief AuthTimeout无效。*/ 99 | /****@brief The authentication expiration time is invalid.*/ 100 | ERROR_SERVER_MPS_INVALID_AUTHTIMEOUT = 0x20010302, 101 | /**@brief Formats无效。*/ 102 | /****@brief The media format is invalid.*/ 103 | ERROR_SERVER_MPS_INVALID_FORMATS = 0x20010303, 104 | /**@brief AuthInfo无效。*/ 105 | /****@brief The authentication information is invalid.*/ 106 | ERROR_SERVER_MPS_INVALID_AUTHINFO = 0x20010304, 107 | /**@brief 签名校验失败。*/ 108 | /****@brief The signature failed verification.*/ 109 | ERROR_SERVER_MPS_SIGNATURE_CHECK_FAILED = 0x20010305, 110 | /**@brief MediaId不存在。*/ 111 | /****@brief The media ID does not exist.*/ 112 | ERROR_SERVER_MPS_MEDIAID_NOT_EXIST = 0x20010306, 113 | /**@brief 媒体资源不存在。*/ 114 | /****@brief The media resource does not exist.*/ 115 | ERROR_SERVER_MPS_MEDIA_RESOURCE_NOT_EXIST = 0x20010307, 116 | /**@brief 媒体没有发布。*/ 117 | /****@brief The media is not published.*/ 118 | ERROR_SERVER_MPS_MEDIA_NOT_PUBLISHED = 0x20010308, 119 | /**@brief 媒体没有加密。*/ 120 | /****@brief The media is not encrypted.*/ 121 | ERROR_SERVER_MPS_MEDIA_NOT_ENCRYPTED = 0x20010309, 122 | /**@brief ciphertextblob无效。*/ 123 | /****@brief The ciphertextBlob string is invalid.*/ 124 | ERROR_SERVER_MPS_INVALID_CIPHERTEXTBLOB = 0x2001030A, 125 | /**@brief CipherTextBlob不存在。*/ 126 | /****@brief The ciphertextBlob string does not exist.*/ 127 | ERROR_SERVER_MPS_CIPHERBLOB_NOT_EXIST = 0x2001030B, 128 | /**@brief 服务器内部错误。*/ 129 | /****@brief An internal server error has occurred.*/ 130 | ERROR_SERVER_MPS_INTERNAL_ERROR = 0x2001030C, 131 | /**@brief 请求标识不允许操作。*/ 132 | /****@brief You are not authorized to perform the operation.*/ 133 | ERROR_SERVER_MPS_INVALID_IDENTITY_NOT_ORDER_VIDEO_SERVICE = 0x2001030D, 134 | /**@brief 更新主机配置失败。*/ 135 | /****@brief The host configuration failed to be updated.*/ 136 | ERROR_SERVER_MPS_UPDATE_CDN_DOMAIN_CONFIGS_FAIL = 0x2001030E, 137 | /**@brief auth密钥已经存在。*/ 138 | /****@brief The AccessKey secret for authentication has been used by another account.*/ 139 | ERROR_SERVER_MPS_AUTH_KEY_EXIST = 0x2001030F, 140 | /**@brief auth密钥不存在。*/ 141 | /****@brief The AccessKey secret for authentication does not exist.*/ 142 | ERROR_SERVER_MPS_AUTH_KEY_NOT_EXIST = 0x20010310, 143 | /**@brief 参数超出范围。*/ 144 | /****@brief The parameter value is out of the value range.*/ 145 | ERROR_SERVER_MPS_INVALID_PARAMETER_OUT_OF_BOUND = 0x20010311, 146 | /**@brief 参数无效。*/ 147 | /****@brief The parameter is invalid.*/ 148 | ERROR_SERVER_MPS_INVALID_PARAMETER = 0x20010312, 149 | /**@brief 参数不能为null。*/ 150 | /****@brief The parameter value is null. You must specify the parameter.*/ 151 | ERROR_SERVER_MPS_INVALID_PARAMETER_NULL_VALUE = 0x20010313, 152 | /**@brief 参数不能为空。*/ 153 | /****@brief The parameter value is empty. You must specify a non-empty value for the parameter.*/ 154 | ERROR_SERVER_MPS_INVALID_PARAMETER_EMPTY_VALUE = 0x20010314, 155 | /**@brief 媒体资源不匹配。*/ 156 | /****@brief The media resource is not supported.*/ 157 | ERROR_SERVER_MPS_MEDIA_RESOURCE_NOT_MATCH = 0x20010315, 158 | /**@brief 没有找到MediaId的密文资源。*/ 159 | /****@brief The ciphertext of the media ID is not found.*/ 160 | ERROR_SERVER_MPS_MEDIA_NOT_FOUND_CIPHERTEXT = 0x20010316, 161 | /**@brief 指定的参数Rand无效。*/ 162 | /****@brief The specified rand parameter is invalid.*/ 163 | ERROR_SERVER_MPS_INVALID_PARAMETER_RAND = 0x20010317, 164 | /**@brief 缓存连接池为空。*/ 165 | /****@brief The Redis cache connection pool is empty.*/ 166 | ERROR_SERVER_MPS_REDIS_POOL_IS_EMPTY = 0x20010318, 167 | /**@brief 媒体id不匹配。*/ 168 | /****@brief The signature and the media ID do not match.*/ 169 | ERROR_SERVER_MPS_SIGNATURE_CHECK_MEDIA_FAILED = 0x20010319, 170 | /**@brief 指定的到期时间值已过期。*/ 171 | /****@brief The specified timeout value has expired.*/ 172 | ERROR_SERVER_MPS_SIGNATURE_CHECK_EXPIREDTIME_FAILED = 0x2001031A, 173 | /**@brief 指定的参数SessionTime应该是>0。*/ 174 | /****@brief The value of the SessionTime parameter is not greater than 0. Set the parameter to a value greater than 0.*/ 175 | ERROR_SERVER_MPS_INVALID_SESSION_TIME = 0x2001031B, 176 | /**@brief EndUserId长度不对。*/ 177 | /****@brief The length of the EndUserId parameter is incorrect.*/ 178 | ERROR_SERVER_MPS_INVALID_END_USER_ID = 0x2001031C, 179 | /**@brief 指定的参数LicenseUrl格式不正确。*/ 180 | /****@brief The format of the LicenseUrl parameter is incorrect.*/ 181 | ERROR_SERVER_MPS_INVALID_URL = 0x2001031D, 182 | /**@brief 请求失败。*/ 183 | /****@brief The request failed.*/ 184 | ERROR_SERVER_MPS_HTTP_REQUEST_FAILED = 0x2001031E, 185 | /**@brief xml格式出错。*/ 186 | /****@brief The XML format is incorrect.*/ 187 | ERROR_SERVER_MPS_XML_FORMAT_ERROR = 0x2001031F, 188 | /**@brief Session不存在。*/ 189 | /****@brief The session does not exist.*/ 190 | ERROR_SERVER_MPS_SESSION_NOT_EXIST = 0x20010320, 191 | /**@brief API不支持。*/ 192 | /****@brief The API is not supported.*/ 193 | ERROR_SERVER_MPS_REGION_NOT_SUPPORTED_API = 0x20010321, 194 | /**@brief 此区域未激活DRM,请联系我们。*/ 195 | /****@brief Digital rights management (DRM) is not authorized for this region. Contact ApsaraVideo for VOD technical support.*/ 196 | ERROR_SERVER_MPS_DRM_NOT_ACTIVATED = 0x20010322, 197 | /**@brief DRM验证错误,请为此媒体添加授权。*/ 198 | /****@brief DRM verification failed. Authorize DRM for the media.*/ 199 | ERROR_SERVER_MPS_DRM_AUTH_ERROR = 0x20010323, 200 | /**@brief oss域不存在cdn域配置。*/ 201 | /****@brief No Content Delivery Network (CDN) domain name is bound to your Object Storage Service (OSS) bucket.*/ 202 | ERROR_SERVER_MPS_CDN_CONFIG_NOT_EXIST = 0x20010324, 203 | 204 | //------------------ LIVESHIFT begin ------------------------ 205 | /**@brief 时移未知错误。*/ 206 | /****@brief An unknown time shifting error has occurred.*/ 207 | ERROR_SERVER_LIVESHIFT_UNKNOWN = 0x20010400, 208 | /**@brief 时移请求失败。*/ 209 | /****@brief The time shifting request failed.*/ 210 | ERROR_SERVER_LIVESHIFT_REQUEST_ERROR = 0x20010401, 211 | /**@brief 时移数据解析失败。*/ 212 | /****@brief The time shifting data failed to be parsed.*/ 213 | ERROR_SERVER_LIVESHIFT_DATA_PARSER_ERROR = 0x20010402, 214 | 215 | //------------------ KEYMANANGER begin ------------------------ 216 | ERROR_KEYMANAGER_UNKNOWN = 0x20011000, 217 | 218 | //------------------ TBDRM begin ------------------------ 219 | /**@brief 私有加密未知错误。*/ 220 | /****@brief An unknown error has occurred.*/ 221 | ERROR_TBDRM_UNKNOWN = 0x20012000, 222 | /**@brief 私有加密解封装未实现。*/ 223 | /****@brief Transcoded streams encrypted by Alibaba Cloud video encryption cannot be decapsulated.*/ 224 | ERROR_TBDRM_DEMUXER_UNIMPLEMENTED = 0x20012001, 225 | //------------------ UNKNOWN begin ------------------------ 226 | /**@brief 未知错误。*/ 227 | /****@brief An unknown error has occurred.*/ 228 | ERROR_UNKNOWN_ERROR = 0x20020000 - 1, 229 | 230 | /**@brief Demuxer错误起始码。*/ 231 | /****@brief Demuxer error codes.*/ 232 | ERROR_DEMUXER_START = 0x20030000, 233 | /**@brief 打开URL失败。*/ 234 | /****@brief The URL is unavailable.*/ 235 | ERROR_DEMUXER_OPENURL = 0x20030001, 236 | /**@brief 无效的流。*/ 237 | /****@brief The stream is invalid.*/ 238 | ERROR_DEMUXER_NO_VALID_STREAM = 0x20030002, 239 | /**@brief 打开流失败。*/ 240 | /****@brief The stream is unavailable.*/ 241 | ERROR_DEMUXER_OPENSTREAM = 0x20030003, 242 | /**@brief 加载超时。*/ 243 | /****@brief The loading times out.*/ 244 | ERROR_LOADING_TIMEOUT = 0x20030004, 245 | /**@brief 数据源URL为空。*/ 246 | /****@brief The data source URL is not specified.*/ 247 | ERROR_DATASOURCE_EMPTYURL = 0x20030005, 248 | 249 | ERROR_DECODE_BASE = 0x20040000, 250 | /**@brief 视频解码失败。*/ 251 | /****@brief The video decoding failed.*/ 252 | ERROR_DECODE_VIDEO = 0x20040001, 253 | /**@brief 音频解码失败。*/ 254 | /****@brief The audio decoding failed.*/ 255 | ERROR_DECODE_AUDIO = 0x20040002, 256 | 257 | 258 | /**@brief 未知的网络错误。*/ 259 | /****@brief An unknown network error has occurred.*/ 260 | ERROR_NETWORK_UNKNOWN = 0x20050000, 261 | /**@brief 协议不支持。*/ 262 | /****@brief The protocol is not supported.*/ 263 | ERROR_NETWORK_UNSUPPORTED = 0x20050001, 264 | /**@brief 不能解析域名。*/ 265 | /****@brief The domain name cannot be resolved.*/ 266 | ERROR_NETWORK_RESOLVE = 0x20050002, 267 | /**@brief 网络连接超时。*/ 268 | /****@brief The network connection times out.*/ 269 | ERROR_NETWORK_CONNECT_TIMEOUT = 0x20050003, 270 | /**@brief 无法连接到服务器。*/ 271 | /****@brief The server is unavailable.*/ 272 | ERROR_NETWORK_COULD_NOT_CONNECT = 0x20050004, 273 | /**@brief 403错误。*/ 274 | /****@brief An HTTP 403 error has occurred.*/ 275 | ERROR_NETWORK_HTTP_403 = 0x20050005, 276 | /**@brief 404错误。*/ 277 | /****@brief An HTTP 404 error has occurred.*/ 278 | ERROR_NETWORK_HTTP_404 = 0x20050006, 279 | /**@brief 其他的4XX错误。*/ 280 | /****@brief An HTTP 4xx error other than HTTP 403 or HTTP 404 has occurred.*/ 281 | ERROR_NETWORK_HTTP_4XX = 0x20050007, 282 | /**@brief 5XX的服务器错误。*/ 283 | /****@brief An HTTP 5xx error has occurred.*/ 284 | ERROR_NETWORK_HTTP_5XX = 0x20050008, 285 | /**@brief 不支持range请求。*/ 286 | /****@brief The HTTP range request is not supported.*/ 287 | ERROR_NETWORK_HTTP_RANGE = 0x20050009, 288 | /**@brief 400错误。*/ 289 | /****@brief An HTTP 400 error has occurred.*/ 290 | ERROR_NETWORK_HTTP_400 = 0x2005000A, 291 | /**@brief 重定向到了一个不是媒体文件的URL。*/ 292 | /****@brief Redirect to a url that is not a media.*/ 293 | ERROR_NETWORK_HTTP_REDIRECT_NONMEDIA = 0x2005000B, 294 | 295 | 296 | /**@brief 未知的解码错误。*/ 297 | /****@brief An unknown decoding error has occurred.*/ 298 | ERROR_CODEC_UNKNOWN = 0x20060000, 299 | /**@brief 视频编码格式不支持。*/ 300 | /****@brief The video coding format is not supported.*/ 301 | ERROR_CODEC_VIDEO_NOT_SUPPORT = 0x20060001, 302 | /**@brief 音频编码格式不支持。*/ 303 | /****@brief The audio coding format is not supported.*/ 304 | ERROR_CODEC_AUDIO_NOT_SUPPORT = 0x20060002, 305 | 306 | /**@brief 未知的内部错误。*/ 307 | /****@brief An unknown internal error.*/ 308 | ERROR_INERNAL_UNKNOWN = 0x20070000, 309 | /**@brief 内部退出。*/ 310 | /****@brief Exit.*/ 311 | ERROR_INERNAL_EXIT = 0x20070001, 312 | 313 | /**@brief 标准错误。*/ 314 | /****@brief A standard error has occurred.*/ 315 | ERROR_GENERAL_UNKNOWN = 0x20080000, 316 | /**@brief 标准错误-1,操作不允许等。*/ 317 | /****@brief An EPERM error. The operation is not permitted.*/ 318 | ERROR_GENERAL_EPERM = 0x20080001, 319 | /**@brief 标准错误-2,文件不存在等。*/ 320 | /****@brief An ENOENT error. No such file or directory exists.*/ 321 | ERROR_GENERAL_ENOENT = 0x20080002, 322 | /**@brief 标准错误-5,IO错误等。*/ 323 | /****@brief An EIO error. An Input/Output (I/O) error has occurred.*/ 324 | ERROR_GENERAL_EIO = 0x20080005, 325 | 326 | /**@brief 未知错误。*/ 327 | /****@brief .*/ 328 | ERROR_PLAYER_UNKNOWN = 0x30000000 - 1, 329 | 330 | 331 | /**@brief 没有选择下载项。*/ 332 | /****@brief No track is selected for download.*/ 333 | DOWNLOADER_ERROR_NOT_SELECT_ITEM = 0x30010000, 334 | /**@brief 没有可用下载项。*/ 335 | /****@brief No track is available for download.*/ 336 | DOWNLOADER_ERROR_NO_DOWNLOAD_ITEM = 0x30010001, 337 | /**@brief 没有设置Sts源。*/ 338 | /****@brief The source for STS-based playback is not specified.*/ 339 | DOWNLOADER_ERROR_STS_SOURCE_NULL = 0x30010002, 340 | /**@brief 没有设置Auth源。*/ 341 | /****@brief The source for playAuth-based playback is not specified.*/ 342 | DOWNLOADER_ERROR_AUTH_SOURCE_NULL = 0x30010003, 343 | /**@brief Auth格式不对。*/ 344 | /****@brief The authentication format is incorrect.*/ 345 | DOWNLOADER_ERROR_AUTH_SOURCE_WRONG = 0x30010004, 346 | /**@brief 选中的下载项不对。*/ 347 | /****@brief The selected track for download is invalid.*/ 348 | DOWNLOADER_ERROR_INVALID_ITEM = 0x30010005, 349 | /**@brief URL无法连接。*/ 350 | /****@brief The URL is unavailable.*/ 351 | DOWNLOADER_ERROR_URL_CANNOT_REACH = 0x30010006, 352 | /**@brief 下载的格式不支持。*/ 353 | /****@brief The format of the file to be downloaded is not supported.*/ 354 | DOWNLOADER_ERROR_NOT_SUPPORT_FORMAT = 0x30010007, 355 | /**@brief 加密校验文件不匹配。*/ 356 | /****@brief The authentication information in the security file does not match the application information.*/ 357 | DOWNLOADER_ERROR_ENCRYPT_FILE_NOT_MATCH = 0x30010008, 358 | /**@brief 下载功能被关闭。*/ 359 | /****@brief The download feature is disabled.*/ 360 | DOWNLOADER_ERROR_DOWNLOAD_SWITCH_OFF = 0x30010009, 361 | /**@brief 网络出错。*/ 362 | /****@brief A network error has occurred.*/ 363 | DOWNLOADER_ERROR_NET_ERROR = 0x3001000A, 364 | /**@brief 没有设置下载路径。*/ 365 | /****@brief The download directory is not specified.*/ 366 | DOWNLOADER_ERROR_NOT_SET_SAVE_DIR = 0x3001000B, 367 | /**@brief 无法创建下载目录。*/ 368 | /****@brief The download directory cannot be created.*/ 369 | DOWNLOADER_ERROR_CANNOT_CREATE_SAVE_DIR = 0x3001000C, 370 | /**@brief 没有空间。*/ 371 | /****@brief No sufficient space is available.*/ 372 | DOWNLOADER_ERROR_NO_SPACE = 0x3001000D, 373 | /**@brief 写入文件出错。*/ 374 | /****@brief An error occurred while writing the data.*/ 375 | DOWNLOADER_ERROR_WRITE_ERROR = 0x3001000E, 376 | /**@brief 解密失败。*/ 377 | /****@brief An error occurred while decrypting the data.*/ 378 | DOWNLOADER_ERROR_ENCRYPT_ERROR = 0x3001000F, 379 | /**@brief 文件不存在。*/ 380 | /****@brief No such file exists.*/ 381 | DOWNLOADER_ERROR_FILE_NOT_EXIST = 0x30010010, 382 | /**@brief 删除文件参数无效。*/ 383 | /****@brief The parameter that specifies the file to be deleted is invalid.*/ 384 | DOWNLOADER_ERROR_CLEAN_INVALID_PARAM = 0x30010011, 385 | /**@brief 删除文件状态不对。*/ 386 | /****@brief The file status is incorrect. Only files in the stop status can be deleted.*/ 387 | DOWNLOADER_ERROR_CLEAN_WRONG_STATUS = 0x30010012, 388 | /**@brief 获取AES秘钥失败。*/ 389 | /****@brief The AES key failed to be obtained.*/ 390 | DOWNLOADER_ERROR_GET_AES_KEY_FAIL = 0x30010013, 391 | /**@brief 加密方式不支持。*/ 392 | /****@brief The encryption method is not supported.*/ 393 | DOWNLOADER_ERROR_ENCRYPTION_NOT_SUPPORT = 0x30010014, 394 | } AVPErrorCode; 395 | 396 | /**@brief 播放器事件类型,带描述字符串*/ 397 | /****@brief Player event type with a description string.*/ 398 | typedef enum AVPEventWithString: NSUInteger { 399 | /**@brief 设置了硬解,但是切换为软解。额外信息为描述信息。*/ 400 | /****@brief Hardware decoding is switched to software decoding. Additional information: description.*/ 401 | EVENT_SWITCH_TO_SOFTWARE_DECODER = 100, 402 | /**@brief 音频解码格式不支持。额外信息为描述信息。*/ 403 | /****@brief Audio decoding does not support the specified format. Additional information: description.*/ 404 | EVENT_AUDIO_CODEC_NOT_SUPPORT = 101, 405 | /**@brief 音频解码器设备失败。额外信息为描述信息。*/ 406 | /****@brief The audio decoder failed. Additional information: description.*/ 407 | EVENT_AUDIO_DECODER_DEVICE_ERROR = 102, 408 | /**@brief 视频解码格式不支持。额外信息为描述信息。*/ 409 | /****@brief Video decoding does not support the specified format. Additional information: description.*/ 410 | EVENT_VIDEO_CODEC_NOT_SUPPORT = 103, 411 | /**@brief 视频解码器设备失败。额外信息为描述信息。*/ 412 | /****@brief The video decoder failed. Additional information: description.*/ 413 | EVENT_VIDEO_DECODER_DEVICE_ERROR = 104, 414 | /**@brief 视频渲染设备初始化失败。额外信息为描述信息。*/ 415 | /****@brief The video renderer failed. Additional information: description.*/ 416 | EVENT_VIDEO_RENDER_INIT_ERROR = 105, 417 | /**@brief Demuxer trace ID for artp*/ 418 | EVENT_PLAYER_DEMUXER_TRACE_ID = 106, 419 | /**@brief 网络失败,需要重试。无额外信息。*/ 420 | /****@brief Network connection failed. Try again. No additional information is provided.*/ 421 | EVENT_PLAYER_NETWORK_RETRY = 108, 422 | /**@brief 缓存成功。无额外信息。*/ 423 | /****@brief Content cached. No additional information is provided.*/ 424 | EVENT_PLAYER_CACHE_SUCCESS = 109, 425 | /**@brief 缓存失败。额外信息为描述信息。*/ 426 | /****@brief Failed to cache the content. Additional information: description.*/ 427 | EVENT_PLAYER_CACHE_ERROR = 110, 428 | /**@brief 系统无可用内存来存放媒体数据。*/ 429 | /****@brief The system does not have memory to store the media data.*/ 430 | EVENT_PLAYER_LOW_MEMORY = 111, 431 | /**@brief 网络重试成功。无额外信息。*/ 432 | /****@brief Network retry successful. No additional information.*/ 433 | EVENT_PLAYER_NETWORK_RETRY_SUCCESS = 113, 434 | /**@brief 字幕选择失败。额外信息为失败原因。*/ 435 | /****@brief Subtitle selection failed. Additional information is the cause of failure.*/ 436 | EVENT_PLAYER_SUBTITLE_SELECT_ERROR = 114, 437 | /**@brief 后台恢复时所需解码帧过多 */ 438 | /****@brief decoder recover size is too large for background recovery.*/ 439 | EVENT_PLAYER_EVENT_DECODER_RECOVER_SIZE = 115, 440 | 441 | /**@brief 播放组件中透传输出的消息 */ 442 | /****@brief The message passthrough the player component*/ 443 | EVENT_PLAYER_DIRECT_COMPONENT_MSG = 116, 444 | 445 | /**@brief RTS 服务器可能断开连接。*/ 446 | /****@brief RTS server maybe disconnect.*/ 447 | EVENT_PLAYER_RTS_SERVER_MAYBE_DISCONNECT = 0x30010001, 448 | /**@brief RTS 服务器恢复连接。*/ 449 | /****@brief RTS server recover.*/ 450 | EVENT_PLAYER_RTS_SERVER_RECOVER = 0x30010002, 451 | } AVPEventWithString; 452 | 453 | #endif 454 | 455 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AVPFilterConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by SuperMan on 2021/12/1. 3 | // 4 | 5 | #import 6 | 7 | 8 | @interface AVPFilterOptions : NSObject 9 | /** 10 | @brief 设置滤镜参数 11 | */ 12 | /**** 13 | @brief Set filter options 14 | */ 15 | - (void)setOptions:(NSString *)key value:(NSObject *)value; 16 | 17 | - (NSString *)toJSONStr; 18 | 19 | @end 20 | 21 | 22 | @interface AVPFilter : NSObject 23 | /** 24 | @brief 创建滤镜 25 | @param target 目标滤镜 26 | */ 27 | /**** 28 | @brief Init filter 29 | @param target filter target 30 | */ 31 | - (instancetype)initWithTarget:(NSString *)target; 32 | 33 | /** 34 | @brief 设置滤镜参数 35 | @param options 36 | */ 37 | /**** 38 | @brief Set filter options 39 | @param options 40 | */ 41 | - (void)setOptions:(AVPFilterOptions *)options; 42 | 43 | @end 44 | 45 | 46 | @interface AVPFilterConfig : NSObject 47 | 48 | /** 49 | @brief 添加滤镜 50 | @param filter 51 | */ 52 | /**** 53 | @brief Add filter 54 | @param filter 55 | */ 56 | - (void)addFilter:(AVPFilter *)filter; 57 | 58 | - (NSString *)toJSONStr; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AVPLiveKeyGenerator.h: -------------------------------------------------------------------------------- 1 | // 2 | // AVPHlsKeyGenerator.h 3 | // AliPlayerSDK 4 | // 5 | // 6 | 7 | #import 8 | 9 | 10 | @protocol AVPLiveKeyInfoDelegate 11 | 12 | @required 13 | /* 14 | 功能:异步,获取到m3u8中的URI,解析出key,将key相关信息回调出去,如果有两个key,则会回调两次 15 | ekeyGenURL: 密文key的url 16 | ekeyPreGenTime:在多少时间内必须要生成key,这个时间可以用于打散,如果time=0,表示打散时间为0,这个key必须要优先立即生成 17 | */ 18 | /*** 19 | 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. 20 | ekeyGenURL: The URL of the ciphertext key. 21 | ekeyPreGenTime: The maximum key generation time. You can divide the time into multiple periods. If time=0, then the key must be generated immediately. 22 | */ 23 | -(void) onLiveKeyInfo:(NSString*)ekeyGenURL ekeyPreGenTime:(int)time; 24 | 25 | /* 26 | 功能:同步,通过密文key来获取到明文key 27 | ekeyGenURL: 密文key的url 28 | */ 29 | /*** 30 | Feature: Synchronous key generation. Use a ciphertext key to generate a plaintext key. 31 | ekeyGenURL: The URL of the ciphertext key. 32 | */ 33 | -(NSData*) onGetLiveKey:(NSString*)ekeyGenURL; 34 | 35 | @end 36 | 37 | OBJC_EXPORT 38 | @interface AVPLiveKeyGenerator : NSObject 39 | 40 | + (AVPLiveKeyGenerator *) getInstance; 41 | 42 | @property(nonatomic,weak) id delegate; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AVPLiveTimeShift.h: -------------------------------------------------------------------------------- 1 | // 2 | // AVPLiveTimeShift.h 3 | // AliPlayerSDK 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AliPlayer.h" 11 | 12 | OBJC_EXPORT 13 | @interface AVPLiveTimeShift : AliPlayer 14 | 15 | /** 16 | @brief 直播时移,打开直播时移播放地址 17 | @param liveTimeUrl 直播时移播放地址 18 | */ 19 | /**** 20 | @brief Send a request to the broadcasting timeshift URL. 21 | @param liveTimeUrl Broadcasting timeshift URL. 22 | */ 23 | - (void)prepareWithLiveTimeUrl:(NSString*)liveTimeUrl; 24 | 25 | /** 26 | @brief 直播时移,设置直播时移地址 27 | @param liveTimeShiftUrl 直播时移请求地址 28 | */ 29 | /**** 30 | @brief Set a broadcasting timeshift URL. 31 | @param liveTimeShiftUrl Broadcasting timeshift URL. 32 | */ 33 | - (void)setLiveTimeShiftUrl:(NSString*)liveTimeShiftUrl; 34 | 35 | /** 36 | @brief 直播时移,跳转到指定时移位置 37 | @param startTime 跳转到直播startTime位置 38 | */ 39 | /**** 40 | @brief Seek to a specified position. 41 | @param startTime Seek to the position specified by startTime in broadcasting. 42 | */ 43 | - (void)seekToLiveTime:(NSTimeInterval)startTime; 44 | 45 | /** 46 | @brief 直播时移,获取直播时间 47 | */ 48 | /**** 49 | @brief Query the broadcasting time. 50 | */ 51 | @property (nonatomic, assign) NSTimeInterval liveTime; 52 | 53 | /** 54 | @brief 直播时移,获取当前播放时间 55 | */ 56 | /**** 57 | @brief Query the current playback time. 58 | */ 59 | @property (nonatomic, assign) NSTimeInterval currentPlayTime; 60 | 61 | /** 62 | @brief 直播时移,每60秒更新用户时移时间,参考AliyunPlayerVideoTimeShiftModel 63 | */ 64 | /**** 65 | @brief Update the user timeshifting time at an interval of 60 seconds. See AliyunPlayerVideoTimeShiftModel. 66 | */ 67 | @property (nonatomic, strong) AVPTimeShiftModel *timeShiftModel; 68 | 69 | 70 | /** 71 | @brief 停止播放 72 | */ 73 | /**** 74 | @brief Stop the player. 75 | */ 76 | -(void)stop; 77 | 78 | 79 | /** 80 | @brief 开始播放 81 | */ 82 | /**** 83 | @brief Start the player. 84 | */ 85 | -(void)start; 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AVPMediaInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // AVPMediaInfo.h 3 | // AliPlayerSDK 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #ifndef AVPMediaInfo_h 10 | #define AVPMediaInfo_h 11 | 12 | #import 13 | 14 | const static int SELECT_AVPTRACK_TYPE_VIDEO_AUTO = -1; 15 | 16 | /** 17 | @brief track type 18 | * AVPTRACK_TYPE_VIDEO: video track 19 | * AVPTRACK_TYPE_AUDIO: audio track 20 | * AVPTRACK_TYPE_SUBTITLE: subtitle track 21 | * AVPTRACK_TYPE_MIXED: have auido and video info in this track 22 | */ 23 | typedef enum AVPTrackType: NSUInteger { 24 | AVPTRACK_TYPE_VIDEO, 25 | AVPTRACK_TYPE_AUDIO, 26 | AVPTRACK_TYPE_SUBTITLE, 27 | AVPTRACK_TYPE_SAAS_VOD,//track from vod 28 | } AVPTrackType; 29 | 30 | OBJC_EXPORT 31 | @interface AVPTrackInfo : NSObject 32 | 33 | /** 34 | @brief track type @see AVPTrackType 35 | */ 36 | @property (nonatomic, assign) AVPTrackType trackType; 37 | 38 | /** 39 | @brief vod format 40 | */ 41 | @property (nonatomic, copy) NSString* vodFormat; 42 | 43 | /** 44 | @brief track index 45 | */ 46 | @property (nonatomic, assign) int trackIndex; 47 | 48 | /** 49 | @brief track definition, only meaningful if the trackType is AVPTRACK_TYPE_SAAS_VOD 50 | */ 51 | @property (nonatomic, copy) NSString* trackDefinition; 52 | 53 | /** 54 | @brief vod file size, only meaningful if the trackType is AVPTRACK_TYPE_SAAS_VOD 55 | */ 56 | @property (nonatomic, assign) int64_t vodFileSize; 57 | 58 | /** 59 | @brief vod play URL, only meaningful if the trackType is AVPTRACK_TYPE_SAAS_VOD 60 | */ 61 | @property (nonatomic, copy) NSString* vodPlayUrl; 62 | 63 | /** 64 | @brief waterMark URL, only meaningful if the trackType is AVPTRACK_TYPE_SAAS_VOD 65 | */ 66 | @property (nonatomic, copy) NSString* waterMarkUrl; 67 | 68 | /** 69 | @brief video width, only meaningful if the trackType is AVPTRACK_TYPE_VIDEO 70 | */ 71 | @property (nonatomic, assign) int videoWidth; 72 | 73 | /** 74 | @brief video height, only meaningful if the trackType is AVPTRACK_TYPE_VIDEO 75 | */ 76 | @property (nonatomic, assign) int videoHeight; 77 | 78 | /** 79 | @brief bitrate, only meaningful if the trackType is AVPTRACK_TYPE_VIDEO 80 | */ 81 | @property (nonatomic, assign) int trackBitrate; 82 | 83 | /** 84 | @brief the number of audio channel, only meaningful if the trackType is AVPTRACK_TYPE_AUDIO 85 | */ 86 | @property (nonatomic, assign) int audioChannels; 87 | 88 | /** 89 | @brief audio samplerate, only meaningful if the trackType is AVPTRACK_TYPE_AUDIO 90 | */ 91 | @property (nonatomic, assign) int audioSamplerate; 92 | 93 | /** 94 | @brief audio sampleFormat, only meaningful if the trackType is AVPTRACK_TYPE_AUDIO 95 | */ 96 | @property (nonatomic, assign) int audioSampleFormat; 97 | 98 | /** 99 | @brief audio Language, only meaningful if the trackType is AVPTRACK_TYPE_AUDIO 100 | */ 101 | @property (nonatomic, copy) NSString* audioLanguage; 102 | 103 | /** 104 | @brief subtitle Language, only meaningful if the trackType is AVPTRACK_TYPE_SUBTITLE 105 | */ 106 | @property (nonatomic, copy) NSString* subtitleLanguage; 107 | 108 | 109 | @end 110 | 111 | 112 | OBJC_EXPORT 113 | @interface AVPThumbnailInfo : NSObject 114 | 115 | /** 116 | @brief thumbnail URL 117 | */ 118 | @property (nonatomic, copy) NSString* URL; 119 | 120 | @end 121 | 122 | 123 | OBJC_EXPORT 124 | @interface AVPMediaInfo : NSObject 125 | 126 | /** 127 | @brief media title 128 | */ 129 | @property (nonatomic, copy) NSString* title; 130 | 131 | /** 132 | @brief media cover url 133 | */ 134 | @property (nonatomic, copy) NSString* coverURL; 135 | 136 | /** 137 | @brief media type 138 | * video audio video|audio 139 | */ 140 | @property (nonatomic, copy) NSString* mediaType; 141 | 142 | /** 143 | @brief media status 144 | */ 145 | @property (nonatomic, copy) NSString* status; 146 | 147 | /** 148 | @brief media duration 149 | * 单位: 毫秒 150 | */ 151 | /**** 152 | @brief media duration 153 | * Unit: millisecond. 154 | */ 155 | @property (nonatomic, assign) int64_t duration; 156 | 157 | /** 158 | @brief 文件码率(vod 和多码率时值为0,应该使用AVPTrackInfo中的trackBitrate) 159 | */ 160 | /**** 161 | @brief Retrievable bit rate (VOD and multi-bit rate values are 0; Should use trackBitrate in AVPTrackInfo) 162 | */ 163 | @property(nonatomic, assign) int64_t totalBitrate; 164 | 165 | /** 166 | @brief media transcodeMode 167 | *转码类型,取值:FastTranscode(上传完成即转码,且转码完成才能播放),NoTranscode(上传完成不转码,且立即能播放),默认取值FastTranscode 168 | */ 169 | /**** 170 | @brief media transcodeMode 171 | *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. 172 | */ 173 | @property (nonatomic, copy) NSString* transcodeMode; 174 | 175 | /** 176 | @brief thumbnails in media info 177 | */ 178 | @property (nonatomic, strong) NSArray* thumbnails; 179 | 180 | /** 181 | @brief tracks in media info 182 | */ 183 | @property (nonatomic, strong) NSArray* tracks; 184 | 185 | @end 186 | 187 | #endif /* AVPMediaInfo_h */ 188 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AVPSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // AVPSource.h 3 | // AliPlayerSDK 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #ifndef AVPSource_h 10 | #define AVPSource_h 11 | 12 | #import 13 | 14 | typedef int (^BitStreamReadCallbackBlock)(uint8_t *buffer, int size); 15 | 16 | typedef long (^BitStreamSeekCallbackBlock)(long offset, int whence); 17 | 18 | static const int SEEK_SIZE = 0x10000; 19 | 20 | typedef NS_ENUM(NSUInteger, ENCRYPTION_TYPE) { ENCRYPTION_TYPE_NONE = 0, ENCRYPTION_TYPE_ALIVODENCRYPTION, ENCRYPTION_TYPE_FAIRPLAY }; 21 | 22 | OBJC_EXPORT 23 | @interface AVPSource : NSObject 24 | 25 | /** 26 | @brief 封面地址 27 | */ 28 | /**** 29 | @brief The URL of the album cover. 30 | */ 31 | @property (nonatomic, copy) NSString* coverURL; 32 | 33 | /** 34 | @brief 视频标题 35 | */ 36 | /**** 37 | @brief The title of the video. 38 | */ 39 | @property (nonatomic, copy) NSString* title; 40 | 41 | /** 42 | @brief 期望播放的清晰度 43 | */ 44 | /**** 45 | @brief The preferred definition for playback. 46 | */ 47 | @property (nonatomic, copy) NSString* quality; 48 | 49 | /** 50 | @brief 是否强制使用此清晰度。如果强制,则在没有对应清晰度的情况下播放不了。 51 | */ 52 | /**** 53 | @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. 54 | */ 55 | @property (nonatomic, assign) BOOL forceQuality; 56 | 57 | /** 58 | @brief 设置点播服务器返回的码率清晰度类型。例如:"FD,LD,SD,HD,OD,2K,4K,SQ,HQ"。 59 | * 注意:如果类型为"AUTO", 那么只会返回自适应码率流。 60 | */ 61 | @property (nonatomic, copy) NSString* definitions; 62 | 63 | @end 64 | 65 | 66 | OBJC_EXPORT 67 | @interface AVPUrlSource : AVPSource 68 | 69 | /** 70 | @brief init AVPUrlSource with url 71 | @param url video url address 72 | */ 73 | - (instancetype) urlWithString:(NSString*)url; 74 | 75 | /** 76 | @brief init AVPUrlSource with filepath 77 | @param url file path 78 | */ 79 | - (instancetype) fileURLWithPath:(NSString*)url; 80 | 81 | /** 82 | @brief player url 83 | */ 84 | @property (nonatomic, copy) NSURL* playerUrl; 85 | 86 | /** 87 | @brief cache file path, app may cache the beginning of remote mp4 file to local path, 88 | * set it to player to improve loading speed. 89 | */ 90 | @property (nonatomic, copy) NSString* cacheFile; 91 | 92 | @property(nonatomic) uint64_t originSize; 93 | 94 | @end 95 | 96 | 97 | OBJC_EXPORT 98 | @interface AVPBitStreamSource : AVPSource 99 | 100 | @property(nonatomic, copy) BitStreamReadCallbackBlock mBitStreamReadCallbackBlock; 101 | 102 | @property(nonatomic, copy) BitStreamSeekCallbackBlock mBitStreamSeekCallbackBlock; 103 | 104 | @end 105 | 106 | 107 | OBJC_EXPORT 108 | @interface AVPVidStsSource : AVPSource 109 | 110 | /** 111 | @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 112 | @param vid 视频播放的vid标识 113 | @param accessKeyId 用户sts的accessKey ID 114 | @param accessKeySecret 用户sts的accessKey secret 115 | @param securityToken 用户sts的token信息 116 | @param region 用户sts的region信息 117 | */ 118 | /**** 119 | @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 120 | @param vid The VID of the video. 121 | @param accessKeyId The AccessKey ID of the user. 122 | @param accessKeySecret The AccessKey Secret of the user. 123 | @param securityToken The token information of the user. 124 | @param region The region information of the user. 125 | */ 126 | - (instancetype)initWithVid:(NSString *)vid 127 | accessKeyId:(NSString *)accessKeyId 128 | accessKeySecret:(NSString *)accessKeySecret 129 | securityToken:(NSString *)securityToken 130 | region:(NSString *)region; 131 | 132 | - (instancetype)initWithVid:(NSString *)vid 133 | accessKeyId:(NSString *)accessKeyId 134 | accessKeySecret:(NSString *)accessKeySecret 135 | securityToken:(NSString *)securityToken 136 | region:(NSString *)region 137 | playConfig:(NSString *)playConfig; 138 | 139 | - (instancetype)initWithVid:(NSString *)vid 140 | accessKeyId:(NSString *)accessKeyId 141 | accessKeySecret:(NSString *)accessKeySecret 142 | securityToken:(NSString *)securityToken 143 | region:(NSString *)region 144 | format:(NSString *)format 145 | playConfig:(NSString *)playConfig; 146 | 147 | /** 148 | @brief vid 149 | */ 150 | @property (nonatomic, copy) NSString* vid; 151 | 152 | /** 153 | @brief accessKeyId 154 | */ 155 | @property (nonatomic, copy) NSString* accessKeyId; 156 | 157 | /** 158 | @brief accessKeySecret 159 | */ 160 | @property (nonatomic, copy) NSString* accessKeySecret; 161 | 162 | /** 163 | @brief securityToken 164 | */ 165 | @property (nonatomic, copy) NSString* securityToken; 166 | 167 | /** 168 | @brief region 169 | */ 170 | @property (nonatomic, copy) NSString* region; 171 | 172 | /** 173 | @brief playConfig 174 | */ 175 | @property (nonatomic, copy) NSString* playConfig; 176 | 177 | /** 178 | @brief format,default is nil, value is "mp4,mp3,flv,m3u8" 179 | */ 180 | @property (nonatomic, copy) NSString* format; 181 | /** 182 | @brief authTimeout 183 | */ 184 | @property (nonatomic, assign) long authTimeout; 185 | /** 186 | @brief resultType 187 | */ 188 | @property (nonatomic, copy) NSString* resultType; 189 | /** 190 | @brief reAuthInfo 191 | */ 192 | @property (nonatomic, copy) NSString* reAuthInfo; 193 | /** 194 | @brief streamType 195 | */ 196 | @property (nonatomic, copy) NSString* streamType; 197 | /** 198 | @brief outputType 199 | */ 200 | @property (nonatomic, copy) NSString* outputType; 201 | 202 | 203 | @end 204 | 205 | OBJC_EXPORT 206 | @interface AVPVidAuthSource : AVPSource 207 | 208 | - (instancetype)initWithVid:(NSString *)vid 209 | playAuth:(NSString *)playAuth 210 | region:(NSString *)region; 211 | 212 | - (instancetype)initWithVid:(NSString *)vid 213 | playAuth:(NSString *)playAuth 214 | region:(NSString *)region 215 | playConfig:(NSString *)playConfig; 216 | 217 | - (instancetype)initWithVid:(NSString *)vid 218 | playAuth:(NSString *)playAuth 219 | region:(NSString *)region 220 | format:(NSString *)format 221 | playConfig:(NSString *)playConfig; 222 | 223 | /** 224 | @brief vid 225 | */ 226 | @property (nonatomic, copy) NSString* vid; 227 | 228 | /** 229 | @brief playAuth 230 | */ 231 | @property (nonatomic, copy) NSString* playAuth; 232 | 233 | /** 234 | @brief region 235 | */ 236 | @property (nonatomic, copy) NSString* region; 237 | 238 | /** 239 | @brief playConfig 240 | */ 241 | @property (nonatomic, copy) NSString* playConfig; 242 | 243 | /** 244 | @brief format,default is nil, value is "mp4,mp3,flv,m3u8" 245 | */ 246 | @property (nonatomic, copy) NSString* format; 247 | /** 248 | @brief authTimeout 249 | */ 250 | @property (nonatomic, assign) long authTimeout; 251 | /** 252 | @brief resultType 253 | */ 254 | @property (nonatomic, copy) NSString* resultType; 255 | /** 256 | @brief reAuthInfo 257 | */ 258 | @property (nonatomic, copy) NSString* reAuthInfo; 259 | /** 260 | @brief streamType 261 | */ 262 | @property (nonatomic, copy) NSString* streamType; 263 | /** 264 | @brief outputType 265 | */ 266 | @property (nonatomic, copy) NSString* outputType; 267 | 268 | @end 269 | 270 | OBJC_EXPORT 271 | @interface AVPVidMpsSource : AVPSource 272 | 273 | /** 274 | @brief 用vid和MPS信息来播放视频,视频转码服务用户使用播放方式。部分参数参考:https://help.aliyun.com/document_detail/53522.html?spm=5176.doc53534.2.5.mhSfOh 275 | @param vid 视频播放的vid标识 276 | @param accId 用户sts的accessKey ID 277 | @param accSecret 用户sts的accessKey secret 278 | @param stsToken 用户sts的token信息 279 | @param authInfo 用户authInfo信息 280 | @param region 用户region信息 281 | @param playDomain 用户playDomain信息 282 | @param mtsHlsUriToken 用户mtsHlsUriToken信息 283 | */ 284 | /**** 285 | @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 286 | @param vid The VID of the video. 287 | @param accId The AccessKey ID of the user. 288 | @param accSecret The AccessKey Secret of the user. 289 | @param stsToken The token information of the user. 290 | @param authInfo The authInfo of the user. 291 | @param region The region information of the user. 292 | @param playDomain The playDomain information of the user. 293 | @param mtsHlsUriToken The mtsHlsUriToken information of the user. 294 | */ 295 | - (instancetype)initWithVid:(NSString*)vid 296 | accId:(NSString *)accId 297 | accSecret:(NSString*)accSecret 298 | stsToken:(NSString*)stsToken 299 | authInfo:(NSString*)authInfo 300 | region:(NSString*)region 301 | playDomain:(NSString*)playDomain 302 | mtsHlsUriToken:(NSString*)mtsHlsUriToken; 303 | 304 | /** 305 | @brief vid 306 | */ 307 | @property (nonatomic, copy) NSString* vid; 308 | 309 | /** 310 | @brief accId 311 | */ 312 | @property (nonatomic, copy) NSString* accId; 313 | 314 | /** 315 | @brief accSecret 316 | */ 317 | @property (nonatomic, copy) NSString* accSecret; 318 | 319 | /** 320 | @brief stsToken 321 | */ 322 | @property (nonatomic, copy) NSString* stsToken; 323 | 324 | /** 325 | @brief authInfo 326 | */ 327 | @property (nonatomic, copy) NSString* authInfo; 328 | 329 | /** 330 | @brief region 331 | */ 332 | @property (nonatomic, copy) NSString* region; 333 | 334 | /** 335 | @brief playDomain 336 | */ 337 | @property (nonatomic, copy) NSString* playDomain; 338 | 339 | /** 340 | @brief mtsHlsUriToken 341 | */ 342 | @property (nonatomic, copy) NSString* mtsHlsUriToken; 343 | 344 | @end 345 | 346 | OBJC_EXPORT 347 | @interface AVPLiveStsSource : AVPSource 348 | 349 | - (instancetype)initWithUrl:(NSString *)url 350 | accessKeyId:(NSString *)accessKeyId 351 | accessKeySecret:(NSString *)accessKeySecret 352 | securityToken:(NSString *)securityToken 353 | region:(NSString *)region 354 | domain:(NSString *)domain 355 | app:(NSString *)app 356 | stream:(NSString *)stream 357 | encryptionType:(ENCRYPTION_TYPE)encryptionType; 358 | 359 | /** 360 | @brief url 361 | */ 362 | @property (nonatomic, copy) NSString* url; 363 | 364 | /** 365 | @brief accessKeyId 366 | */ 367 | @property (nonatomic, copy) NSString* accessKeyId; 368 | 369 | /** 370 | @brief accessKeySecret 371 | */ 372 | @property (nonatomic, copy) NSString* accessKeySecret; 373 | 374 | /** 375 | @brief securityToken 376 | */ 377 | @property (nonatomic, copy) NSString* securityToken; 378 | 379 | /** 380 | @brief region 381 | */ 382 | @property (nonatomic, copy) NSString* region; 383 | 384 | /** 385 | @brief domain 386 | */ 387 | @property (nonatomic, copy) NSString* domain; 388 | 389 | /** 390 | @brief app 391 | */ 392 | @property (nonatomic, copy) NSString* app; 393 | 394 | /** 395 | @brief stream 396 | */ 397 | @property (nonatomic, copy) NSString* stream; 398 | 399 | /** 400 | @brief encryptionType 401 | */ 402 | @property(assign) ENCRYPTION_TYPE encryptionType; 403 | 404 | @end 405 | 406 | #endif /* AVPSource_h */ 407 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AliListPlayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // AliListPlayer.h 3 | // AliListPlayer 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AliPlayer.h" 11 | OBJC_EXPORT 12 | @interface AliListPlayer : AliPlayer 13 | 14 | /** 15 | @brief 初始化播放列表 16 | */ 17 | /**** 18 | @brief Initialize the playlist. 19 | */ 20 | - (instancetype)init; 21 | 22 | /** 23 | @brief 初始化播放器 24 | @param traceID 用于跟踪debug信息 25 | */ 26 | /**** 27 | @brief Initialize the player. 28 | @param traceID The trace ID for debugging. 29 | */ 30 | - (instancetype)init:(NSString*)traceID; 31 | 32 | - (void)stop; 33 | 34 | - (void)destroy; 35 | /** 36 | @brief 添加资源到播放列表中 37 | @param vid vid的播放方式 38 | @param uid 该资源的uid,代表在列表中的唯一标识 39 | */ 40 | /**** 41 | @brief Add a resource to the playlist. 42 | @param vid Specify a resource by VID. 43 | @param uid The UID of the resource, which uniquely identifies a resource. 44 | */ 45 | - (void) addVidSource:(NSString*)vid uid:(NSString*)uid; 46 | 47 | /** 48 | @brief 添加资源到播放列表中 49 | @param url url的播放方式 50 | @param uid 该资源的uid,代表在列表中的唯一标识 51 | */ 52 | /**** 53 | @brief Add a resource to the playlist. 54 | @param url Specify a resource by URL. 55 | @param uid The UID of the resource, which uniquely identifies a resource. 56 | */ 57 | - (void) addUrlSource:(NSString*)url uid:(NSString*)uid; 58 | 59 | /** 60 | @brief 从播放列表中删除指定资源 61 | @param uid 该资源的uid,代表在列表中的唯一标识 62 | */ 63 | /**** 64 | @brief Remove a resource from the playlist. 65 | @param uid The UID of the resource, which uniquely identifies a resource. 66 | */ 67 | - (void) removeSource:(NSString*)uid; 68 | 69 | /** 70 | @brief 清除播放列表 71 | */ 72 | /**** 73 | @brief Clear the playlist. 74 | */ 75 | - (void) clear; 76 | 77 | /** 78 | @brief 获取当前播放资源的uid 79 | */ 80 | /**** 81 | @brief Query the UID of the resource that is being played. 82 | */ 83 | - (NSString*) currentUid; 84 | 85 | /** 86 | @brief 当前位置移动到下一个进行准备播放,url播放方式 87 | */ 88 | /**** 89 | @brief Seek to the next resource and prepare for playback. Only playback by URL is supported. 90 | */ 91 | - (BOOL) moveToNext; 92 | 93 | /** 94 | @brief 当前位置移动到上一个进行准备播放,url播放方式 95 | */ 96 | /**** 97 | @brief Seek to the previous resource and prepare for playback. Only playback by URL is supported. 98 | */ 99 | - (BOOL) moveToPre; 100 | 101 | /** 102 | @brief 移动到指定位置开始准备播放,url播放方式 103 | @param uid 指定资源的uid,代表在列表中的唯一标识 104 | */ 105 | /**** 106 | @brief Seek to the specified position and prepare for playback. Only playback by URL is supported. 107 | @param uid The UID of the specified resource, which uniquely identifies a resource. 108 | */ 109 | - (BOOL) moveTo:(NSString*)uid; 110 | 111 | /** 112 | @brief 当前位置移动到下一个进行准备播放,sts播放方式,需要更新sts信息 113 | @param accId vid sts播放方式的accessKeyID 114 | @param accKey vid sts播放方式的accessKeySecret 115 | @param token vid sts播放方式的securtiToken 116 | @param region vid sts播放方式的region 默认cn-shanghai 117 | */ 118 | /**** 119 | @brief Seek to the next resource and prepare for playback. Only playback by STS is supported. You must update the STS information. 120 | @param accId vid The AccessKey ID. 121 | @param accKey vid The AccessKey Secret. 122 | @param token vid The STS token. 123 | @param region vid The specified region. Default: cn-shanghai. 124 | */ 125 | - (BOOL) moveToNext:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region; 126 | 127 | /** 128 | @brief 当前位置移动到上一个进行准备播放,sts播放方式,需要更新sts信息 129 | @param accId vid sts播放方式的accessKeyID 130 | @param accKey vid sts播放方式的accessKeySecret 131 | @param token vid sts播放方式的securtiToken 132 | @param region vid sts播放方式的region 默认cn-shanghai 133 | */ 134 | /**** 135 | @brief Seek to the previous resource and prepare for playback. Only playback by STS is supported. You must update the STS information. 136 | @param accId vid The AccessKey ID. 137 | @param accKey vid The AccessKey Secret. 138 | @param token vid The STS token. 139 | @param region vid The specified region. Default: cn-shanghai. 140 | */ 141 | - (BOOL) moveToPre:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region; 142 | 143 | /** 144 | @brief 移动到指定位置开始准备播放,sts播放方式,需要更新sts信息 145 | @param uid 指定资源的uid,代表在列表中的唯一标识 146 | @param accId vid sts播放方式的accessKeyID 147 | @param accKey vid sts播放方式的accessKeySecret 148 | @param token vid sts播放方式的securtiToken 149 | @param region vid sts播放方式的region 默认cn-shanghai 150 | */ 151 | /**** 152 | @brief Seek to the specified resource and prepare for playback. Only playback by STS is supported. You must update the STS information. 153 | @param uid The UID of the specified resource, which uniquely identifies a resource. 154 | @param accId vid The AccessKey ID. 155 | @param accKey vid The AccessKey Secret. 156 | @param token vid The STS token. 157 | @param region vid The specified region. Default: cn-shanghai. 158 | */ 159 | - (BOOL) moveTo:(NSString*)uid accId:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region; 160 | 161 | 162 | /** 163 | @brief 设置最大的预缓存的内存大小,默认100M,最小20M 164 | */ 165 | /**** 166 | @brief Set the maximum preloading cache size. Default: 100 MB. Minimum: 20 MB. 167 | */ 168 | @property (nonatomic, assign) int maxPreloadMemorySizeMB; 169 | 170 | 171 | /** 172 | @brief 获取/设置预加载的个数,当前位置的前preloadCount和后preloadCount,默认preloadCount = 2 173 | */ 174 | /**** 175 | @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. 176 | */ 177 | @property (nonatomic, assign) int preloadCount; 178 | 179 | /** 180 | @brief 获取/设置列表播放的sts播放方式,指定默认的清晰度,如"LD、HD"等,moveTo之前调用,一旦预加载后不能更改 181 | */ 182 | /**** 183 | @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. 184 | */ 185 | @property (nonatomic, copy) NSString* stsPreloadDefinition; 186 | 187 | @end 188 | 189 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AliMediaLoader.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | 5 | 6 | @protocol AliMediaLoaderStatusDelegate 7 | @optional 8 | 9 | /** 10 | @brief 错误回调 11 | @param url 加载url 12 | @param code 错误码 13 | @param msg 错误描述 14 | */ 15 | /**** 16 | @brief Error callback 17 | @param url the load URL 18 | @param code Error code 19 | @param msg Error description 20 | */ 21 | - (void)onError:(NSString *)url code:(int64_t)code msg:(NSString *)msg; 22 | 23 | /** 24 | @brief 完成回调 25 | @param url 加载url 26 | */ 27 | /**** 28 | @brief Completed callback 29 | @param URL the load URL 30 | */ 31 | - (void)onCompleted:(NSString *)url; 32 | 33 | /** 34 | @brief 取消回调 35 | @param url 加载url 36 | */ 37 | /**** 38 | @brief the Canceled callback 39 | @param URL the load URL 40 | */ 41 | - (void)onCanceled:(NSString *)url; 42 | 43 | @end 44 | 45 | 46 | OBJC_EXPORT 47 | @interface AliMediaLoader : NSObject 48 | 49 | + (instancetype)shareInstance; 50 | 51 | /** 52 | @brief 开始加载文件。异步加载。可以同时加载多个。 53 | @param url 视频文件地址 54 | @param duration 加载的时长大小.单位:毫秒 55 | */ 56 | /**** 57 | @brief Start load. Asynchronous loading. You can load more than one at a time. 58 | @param url Video file url 59 | @param duration Load duration. Unit: millisecond 60 | */ 61 | - (void)load:(NSString *)url duration:(int64_t)duration; 62 | 63 | /** 64 | @brief 取消加载。注意:不会删除已经下载的文件。 65 | @param url 视频文件地址 。为nil或者空,则取消全部。 66 | */ 67 | /**** 68 | @brief Cancel load. Note: Downloaded files will not be deleted. 69 | @param url Video file url. Nil or null, cancel all. 70 | */ 71 | - (void)cancel:(NSString *)url; 72 | 73 | /** 74 | @brief 暂停加载。 75 | @param url 视频文件地址。 为nil或者空,则暂停全部。 76 | */ 77 | /**** 78 | @brief pause load. 79 | @param url Video file url. Nil or null, pause all. 80 | */ 81 | - (void)pause:(NSString *)url; 82 | 83 | /** 84 | @brief 恢复加载。 85 | @param url 视频文件地址。 为nil或者空,则恢复全部。 86 | */ 87 | /**** 88 | @brief Resume load. 89 | @param url Video file url. Nil or null, resume all. 90 | */ 91 | - (void)resume:(NSString *)url; 92 | 93 | /** 94 | @brief 设置状态代理,参考AliMediaLoaderStatusDelegate 95 | @see AliMediaLoaderStatusDelegate 96 | */ 97 | /**** 98 | @brief, set the status Delegate 99 | @see AliMediaLoaderStatusDelegate 100 | */ 101 | - (void)setAliMediaLoaderStatusDelegate:(id)delegate; 102 | @end 103 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AliPlayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // AliPlayer.h 3 | // AliPlayer 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #import "AVPCacheConfig.h" 10 | #import "AVPConfig.h" 11 | #import "AVPDef.h" 12 | #import "AVPDelegate.h" 13 | #import "AVPFilterConfig.h" 14 | #import "AVPMediaInfo.h" 15 | #import "AVPSource.h" 16 | #import 17 | 18 | @protocol CicadaAudioSessionDelegate; 19 | @protocol CicadaRenderDelegate; 20 | @protocol CicadaRenderingDelegate; 21 | @protocol AliPlayerPictureInPictureDelegate; 22 | 23 | @class AVPFilterConfig; 24 | @class AVPFilterOptions; 25 | 26 | 27 | OBJC_EXPORT 28 | @interface AliPlayer : NSObject 29 | 30 | /** 31 | @brief 初始化播放器 32 | */ 33 | /**** 34 | @brief Initialize the player. 35 | */ 36 | - (instancetype)init; 37 | 38 | /** 39 | @brief 初始化播放器 40 | @param traceID 便于跟踪日志,设为"DisableAnalytics"可关闭日志分析系统(不推荐)。 41 | */ 42 | /**** 43 | @brief Initialize the player. 44 | @param traceID A trace ID for debugging. Set as "DisableAnalytics" to disable report analytics data to server(not recommended). 45 | */ 46 | - (instancetype)init:(NSString*)traceID; 47 | 48 | - (void *)getPlayer; 49 | 50 | /** 51 | @brief 使用url方式来播放视频 52 | @param source AVPUrlSource的输入类型 53 | @see AVPUrlSource 54 | */ 55 | /**** 56 | @brief Play by URL. 57 | @param source AVPUrlSource type. 58 | @see AVPUrlSource 59 | */ 60 | - (void)setUrlSource:(AVPUrlSource*)source; 61 | 62 | /** 63 | @brief 使用bitstream方式来播放视频 64 | @param source AVPBitStreamSource的输入类型 65 | @see AVPBitStreamSource 66 | */ 67 | /**** 68 | @brief Play by bit stream. 69 | @param source AVPBitStreamSource type. 70 | @see AVPBitStreamSource 71 | */ 72 | - (void)setBitStreamSource:(AVPBitStreamSource *)source; 73 | 74 | /** 75 | @brief 用vid和sts来播放视频,sts可参考:https://help.aliyun.com/document_detail/28756.html?spm=a2c4g.11186623.4.4.6f554c07q7B7aS 76 | @param source AVPVidStsSource的输入类型 77 | @see AVPVidStsSource 78 | */ 79 | /**** 80 | @brief Play by VID and STS. For STS, see https://help.aliyun.com/document_detail/28756.html?spm=a2c4g.11186623.4.4.6f554c07q7B7aS 81 | @param source AVPVidStsSource type. 82 | @see AVPVidStsSource 83 | */ 84 | - (void)setStsSource:(AVPVidStsSource*)source; 85 | 86 | /** 87 | @brief 用vid和MPS信息来播放视频。可参考:https://help.aliyun.com/document_detail/53522.html?spm=5176.doc53534.2.5.mhSfOh 88 | @param source AVPVidMpsSource的输入类型 89 | @see AVPVidMpsSource 90 | */ 91 | /**** 92 | @brief Play by VID and MPS. See https://help.aliyun.com/document_detail/53522.html?spm=5176.doc53534.2.5.mhSfOh 93 | @param source AVPVidMpsSource type. 94 | @see AVPVidMpsSource 95 | */ 96 | - (void)setMpsSource:(AVPVidMpsSource*)source; 97 | 98 | /** 99 | @brief 使用vid+playauth方式播放。可参考:https://help.aliyun.com/document_detail/57294.html 100 | @param source AVPVidAuthSource的输入类型 101 | @see AVPVidAuthSource 102 | */ 103 | /**** 104 | @brief Play by VID and playauth. See https://help.aliyun.com/document_detail/57294.html 105 | @param source AVPVidAuthSource type. 106 | @see AVPVidAuthSource 107 | */ 108 | - (void)setAuthSource:(AVPVidAuthSource*)source; 109 | 110 | /** 111 | @brief 使用LiveSts 方式播放直播流 112 | @param source AVPLiveStsSource的输入类型 113 | */ 114 | /**** 115 | @brief Play by 使用LiveSts. 116 | @param source AVPLiveStsSource type. 117 | */ 118 | - (void)setLiveStsSource:(AVPLiveStsSource*)source; 119 | 120 | /** 121 | @brief 更新LiveSts信息 122 | */ 123 | /**** 124 | @brief update liveSts info. 125 | */ 126 | - (void)updateLiveStsInfo:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region; 127 | 128 | /** 129 | @brief 播放准备,异步 130 | */ 131 | /**** 132 | @brief Prepare for playback. Asynchronous callback. 133 | */ 134 | -(void)prepare; 135 | 136 | /** 137 | @brief 开始播放 138 | */ 139 | /**** 140 | @brief Start playing. 141 | */ 142 | -(void)start; 143 | 144 | /** 145 | @brief 暂停播放 146 | */ 147 | /**** 148 | @brief Pause. 149 | */ 150 | -(void)pause; 151 | 152 | /** 153 | @brief 刷新view,例如view size变化时。 154 | */ 155 | /**** 156 | @brief Refresh the view in certain situations, for example, when the size of the view changes. 157 | */ 158 | - (void)redraw DEPRECATED_MSG_ATTRIBUTE("will not take effect"); 159 | 160 | /** 161 | @brief 清空画面。 162 | */ 163 | /**** 164 | @brief Clear screen. 165 | */ 166 | - (void)clearScreen; 167 | 168 | /** 169 | @brief 重置播放 170 | */ 171 | /**** 172 | @brief Reset. 173 | */ 174 | -(void)reset DEPRECATED_ATTRIBUTE; 175 | 176 | /** 177 | @brief 停止播放 178 | */ 179 | /**** 180 | @brief Stop. 181 | */ 182 | -(void)stop; 183 | 184 | /** 185 | @brief 销毁播放器 186 | */ 187 | /**** 188 | @brief Delete the player. 189 | */ 190 | -(void)destroy; 191 | 192 | /** 193 | @brief 跳转到指定的播放位置 194 | @param time 新的播放位置,单位毫秒 195 | @param seekMode seek模式 196 | @see AVPSeekMode 197 | */ 198 | /**** 199 | @brief Seek to a specified position. 200 | @param time The specified position that the player will seek to, Unit: millisecond. 201 | @param seekMode Seek mode. 202 | @see AVPSeekMode 203 | */ 204 | -(void)seekToTime:(int64_t)time seekMode:(AVPSeekMode)seekMode; 205 | 206 | /** 207 | * 设置精准seek的最大间隔。 208 | * @param delta 间隔时间,单位毫秒 209 | */ 210 | /**** 211 | * set the maximum interval of precision seek. 212 | * @param delta interval in milliseconds 213 | */ 214 | -(void)setMaxAccurateSeekDelta:(int)delta; 215 | 216 | /** 217 | @brief 截图 AVPImage: mac平台返回NSImage,iOS平台返回UIImage 218 | */ 219 | /**** 220 | @brief Snapshot. AVPImage: For a Mac platform, NSImage is returned. For an iOS platform, UIImage is returned. 221 | */ 222 | -(void) snapShot; 223 | 224 | /** 225 | @brief 根据trackIndex,切换清晰度 226 | @param trackIndex 选择清晰度的index,SELECT_AVPTRACK_TYPE_VIDEO_AUTO代表自适应码率 227 | */ 228 | /**** 229 | @brief Switch definition according to the specified track index. 230 | @param trackIndex Specify a definition index. SELECT_AVPTRACK_TYPE_VIDEO_AUTO: auto bitrate adjustment. 231 | */ 232 | -(void)selectTrack:(int)trackIndex; 233 | 234 | /** 235 | @brief 根据trackIndex,切换清晰度 236 | @param trackIndex 选择清晰度的index,SELECT_AVPTRACK_TYPE_VIDEO_AUTO代表自适应码率 237 | @param accurate 是否精准跳转。 238 | */ 239 | /**** 240 | @brief Switch definition according to the specified track index. 241 | @param trackIndex Specify a definition index. SELECT_AVPTRACK_TYPE_VIDEO_AUTO: auto bitrate adjustment. 242 | @param accurate Use accurate seeking to select track。 243 | */ 244 | -(void)selectTrack:(int)trackIndex accurate:(BOOL)accurate; 245 | 246 | /** 247 | @brief 获取媒体信息,包括track信息 248 | */ 249 | /**** 250 | @brief Query media information, including track information. 251 | */ 252 | -(AVPMediaInfo*) getMediaInfo; 253 | 254 | /** 255 | @brief 获取当前播放track 256 | @param type track类型 257 | @see AVPTrackType 258 | */ 259 | /**** 260 | @brief Query the track that is being played. 261 | @param type Track type. 262 | @see AVPTrackType 263 | */ 264 | -(AVPTrackInfo*) getCurrentTrack:(AVPTrackType)type; 265 | 266 | /** 267 | @brief 设置缩略图URL 268 | @param URL 缩略图URL 269 | */ 270 | /**** 271 | @brief Specify a thumbnail image URL. 272 | @param URL The specified thumbnail image URL. 273 | */ 274 | -(void) setThumbnailUrl:(NSString *)URL; 275 | 276 | /** 277 | @brief 获取指定位置的缩略图 278 | @param positionMs 代表在哪个指定位置的缩略图 279 | */ 280 | /**** 281 | @brief Retrieve the thumbnail image at the specified position. 282 | @param positionMs The specified position. 283 | */ 284 | -(void)getThumbnail:(int64_t)positionMs; 285 | 286 | /** 287 | @brief 用于跟踪debug信息 288 | @param traceID 指定和其他客户端连接可跟踪的id 289 | */ 290 | /**** 291 | @brief Set a trace ID for debugging. 292 | @param traceID The specified client connection trace ID. 293 | */ 294 | - (void) setTraceID:(NSString*)traceID; 295 | 296 | 297 | /** 298 | @brief 设置转换播放的url的回调函数,一般用于p2p中的url地址转换 299 | @param callback 回调函数指针 300 | */ 301 | /**** 302 | @brief Set a URL conversion callback. URL conversion is typically used in P2P broadcasting. 303 | @param callback The function pointer of the callback. 304 | */ 305 | - (void) setPlayUrlConvertCallback:(PlayURLConverCallback)callback; 306 | /** 307 | @brief 播放器设置 308 | @param config AVPConfig类型 309 | @see AVPConfig 310 | */ 311 | /**** 312 | @brief Modify player configuration. 313 | @param config AVPConfig type. 314 | @see AVPConfig 315 | */ 316 | -(void) setConfig:(AVPConfig*)config; 317 | 318 | /** 319 | @brief 获取播放器设置 320 | @see AVPConfig 321 | */ 322 | /**** 323 | @brief Query player configuration. 324 | @see AVPConfig 325 | */ 326 | -(AVPConfig*) getConfig; 327 | 328 | /** 329 | @brief 设置缓存配置 330 | @param AVPCacheConfig 缓存配置。{@link AVPCacheConfig}。 331 | @return 设置成功返回YES 332 | */ 333 | /**** 334 | @brief Modify cache configuration. 335 | @param AVPCacheConfig Cache configuration. {@link AVPCacheConfig}. 336 | @return If the cache configuration is modified, YES is returned. 337 | */ 338 | -(BOOL) setCacheConfig:(AVPCacheConfig *)cacheConfig; 339 | 340 | /** 341 | @brief 设置滤镜配置。在prepare之前调用此方法。如果想更新,调用updateFilterConfig() 342 | @param filterConfig 343 | */ 344 | /**** 345 | @brief Set filter config. call this before prepare. If want update filter config, call updateFilterConfig() 346 | @param filterConfig 347 | */ 348 | - (void)setFilterConfig:(AVPFilterConfig *)filterConfig; 349 | 350 | /** 351 | @brief更新滤镜配置 352 | @param target 353 | @param options 354 | */ 355 | /**** 356 | @brief upadate filter config. 357 | @param target 358 | @param options 359 | */ 360 | - (void)updateFilterConfig:(NSString *)target options:(AVPFilterOptions *)options; 361 | /** 362 | @brief 开启关闭滤镜. 363 | @param target 如果为空,则对所有滤镜生效 364 | @param invalid true: 开启; false: 关闭 365 | */ 366 | /**** 367 | @brief disable/enable filter. 368 | @param target if empty , disable all filters. 369 | @param invalid true: enable(default); false: disable 370 | */ 371 | - (void)setFilterInvalid:(NSString *)target invalid:(BOOL)invalid; 372 | 373 | /** 374 | @brief 根据url获取缓存的文件名。如果有自定义的规则,请实现delegate {@link onGetCacheNameByURL}。 375 | @brief 如果没有实现delegate,将会采用默认逻辑生成文件名。 376 | @param URL URL 377 | * @return 最终缓存的文件名(不包括后缀。缓存文件的后缀名统一为.alv)。 378 | */ 379 | /**** 380 | @brief Query the name of the cached file with the specified URL. If a custom rule is set, delegate {@link onGetCacheNameByURL}. 381 | @brief If the delegation failed, the default logic is used to generate the file name. 382 | @param URL The URL of the cached file. 383 | * @return The name of the cached file. The file extension is not included. All files use the .alv extension. 384 | */ 385 | -(NSString *) getCacheFilePath:(NSString *)URL; 386 | 387 | /** 388 | @brief 根据url获取缓存的文件名。如果有自定义的规则,请实现delegate {@link onCacheNameByVidCallback}。 389 | @brief 如果没有实现delegate,将会采用默认逻辑生成文件名。 390 | @param vid 视频id 391 | @param format 视频格式 392 | @param definition 视频清晰度 393 | @return 最终缓存的文件名(不包括后缀。缓存文件的后缀名统一为.alv)。 394 | */ 395 | /**** 396 | @brief Query the name of the cached file with the specified URL. If a custom rule is set, delegate {@link onCacheNameByVidCallback}. 397 | @brief If the delegation failed, the default logic is used to generate the file name. 398 | @param vid The VID of the video. 399 | @param format The format of the video. 400 | @param definition The definition of the video. 401 | @return The name of the cached file. The file extension is not included. All files use the .alv extension. 402 | */ 403 | -(NSString *) getCacheFilePath:(NSString *)vid format:(NSString *)format definition:(NSString *)definition; 404 | 405 | /** 406 | @brief 根据url获取缓存的文件名。如果有自定义的规则,请实现delegate {@link onCacheNameByVidCallback}。 407 | @brief 如果没有实现delegate,将会采用默认逻辑生成文件名。 408 | @param vid 视频id 409 | @param format 视频格式 410 | @param definition 视频清晰度 411 | @param previewTime 试看时长 412 | @return 最终缓存的文件名(不包括后缀。缓存文件的后缀名统一为.alv)。 413 | */ 414 | /**** 415 | @brief Query the name of the cached file with the specified URL. If a custom rule is set, delegate {@link onCacheNameByVidCallback}. 416 | @brief If the delegation failed, the default logic is used to generate the file name. 417 | @param vid The VID of the video. 418 | @param format The format of the video. 419 | @param definition The definition of the video. 420 | @param previewTime The preview duration of the video. 421 | @return The name of the cached file. The file extension is not included. All files use the .alv extension. 422 | */ 423 | -(NSString *) getCacheFilePath:(NSString *)vid format:(NSString *)format definition:(NSString *)definition previewTime:(int)previewTime; 424 | 425 | /** 426 | @brief 添加外挂字幕。 427 | @param URL 字幕地址 428 | */ 429 | /**** 430 | @brief Add external subtitles 431 | @param URL subtitle address 432 | */ 433 | -(void) addExtSubtitle:(NSString *)URL; 434 | 435 | /** 436 | @brief 选择外挂字幕 437 | @param trackIndex 字幕索引 438 | @param enable true:选择,false:关闭 439 | */ 440 | /**** 441 | @brief Select external subtitles 442 | @param trackIndex caption index 443 | @param enable true: select, false: close 444 | */ 445 | -(void) selectExtSubtitle:(int)trackIndex enable:(BOOL)enable; 446 | 447 | /** 448 | * 设置某路流相对于主时钟的延时时间,默认是0, 目前只支持外挂字幕 449 | * @param index 流的索引 450 | * @param time 延时,单位毫秒 451 | */ 452 | /**** 453 | * set the delay time of the stream 454 | * @param index steam index 455 | * @param time ms 456 | */ 457 | 458 | - (void)setStreamDelayTime:(int)index time:(int)time; 459 | 460 | 461 | /** 462 | @brief 重新加载。比如网络超时时,可以重新加载。 463 | */ 464 | /**** 465 | @brief Reload resources. You can reload resources when the network connection times out. 466 | */ 467 | -(void) reload; 468 | 469 | /** 470 | @brief 根据key获取相应的信息。 471 | @param key 关键字枚举值 472 | * @return 相应信息(找不到相应信息返回空字符串)。 473 | */ 474 | /**** 475 | @brief Get information by key. 476 | @param key The enum of key 477 | * @return corresponding information, return "" if doesn't exist. 478 | */ 479 | -(NSString *) getPropertyString:(AVPPropertyKey)key; 480 | 481 | /** 482 | @brief 设置多码率时默认播放的码率。将会选择与之最接近的一路流播放。 483 | @param bandWidth 播放的码率。 484 | */ 485 | /**** 486 | @brief Set the default playback bitrate for multi-bit rate. The nearest stream will be selected. 487 | @param bandWidth bit rate . 488 | */ 489 | -(void) setDefaultBandWidth:(int)bandWidth; 490 | 491 | #if TARGET_OS_IPHONE 492 | /** 493 | @brief 设置视频的背景色 494 | @param color the color 495 | */ 496 | /**** 497 | @brief Set video background color 498 | @param color the color 499 | */ 500 | -(void) setVideoBackgroundColor:(UIColor *)color; 501 | 502 | /** 503 | @brief 设置视频快速启动 504 | @param enable true:开启,false:关闭 505 | */ 506 | /**** 507 | @brief Set video fast start 508 | @param enable true:enable,false: disable 509 | */ 510 | -(void) setFastStart:(BOOL)enable; 511 | 512 | /** 513 | @brief 设置ip解析类型 514 | @param type ip解析类型 515 | */ 516 | /**** 517 | @brief Set ip resolve type 518 | @param type ip resolve type 519 | */ 520 | -(void) setIPResolveType:(AVPIpResolveType)type; 521 | #endif 522 | 523 | /** 524 | @brief 设置代理 参考AVPEventReportParamsDelegate 525 | @see AVPEventReportParamsDelegate 526 | */ 527 | /**** 528 | @brief Set a proxy. See AVPEventReportParamsDelegate. 529 | @see AVPEventReportParamsDelegate 530 | */ 531 | -(void) setEventReportParamsDelegate:(id)delegate; 532 | 533 | /** 534 | * @brief 获取播放器的参数 535 | * 536 | * @param key 参数值 537 | * @return 相关信息 538 | */ 539 | /**** 540 | * @brief Get player information 541 | * 542 | * @param key The key 543 | * @return The information 544 | */ 545 | -(NSString *) getOption:(AVPOption)key; 546 | 547 | 548 | /** 549 | @brief 向播放器的组件发送命令。 550 | @param content 命令内容。 551 | @return 命令执行结果, < 0 失败。 552 | */ 553 | /**** 554 | @brief Send command to component 555 | @param content command content 556 | @return < 0 on Error 557 | */ 558 | 559 | - (int)invokeComponent:(NSString *)content; 560 | /** 561 | @brief 获取SDK版本号信息 562 | */ 563 | /**** 564 | @brief Query the SDK version. 565 | */ 566 | + (NSString *)getSDKVersion; 567 | 568 | /** 569 | @brief 获取设备UUID 570 | */ 571 | /**** 572 | @brief Query device UUID. 573 | */ 574 | + (NSString *)getDeviceUUID; 575 | 576 | /** 577 | @brief 返回某项功能是否支持 578 | @param type 是否支持的功能的类型。 参考SupportFeatureType。 579 | */ 580 | /**** 581 | @brief judge whether support the type of feature. 582 | @param type The type of the support feature. See SupportFeatureType. 583 | */ 584 | + (BOOL)isFeatureSupport:(SupportFeatureType)type; 585 | 586 | /** 587 | @brief 初始化播放器组件。这些组件是可裁剪的。App可删除相应动态库,去掉初始化组件代码,实现裁剪。 588 | */ 589 | /**** 590 | @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. 591 | */ 592 | + (void)initPlayerComponent:(NSString *)functionName function:(void *)function; 593 | 594 | /** 595 | @brief 设置是否静音,支持KVO 596 | */ 597 | /**** 598 | @brief Mute or unmute the player. KVO is supported. 599 | */ 600 | @property(nonatomic, getter=isMuted) BOOL muted; 601 | 602 | /** 603 | @brief 播放速率,0.5-2.0之间,1为正常播放,支持KVO 604 | */ 605 | /**** 606 | @brief Set the playback speed. Valid values: 0.5 to 2.0. Value 1 indicates normal speed. KVO is supported. 607 | */ 608 | @property(nonatomic) float rate; 609 | 610 | /** 611 | @brief 是否开启硬件解码,支持KVO 612 | */ 613 | /**** 614 | @brief Enable or disable hardware decoding. KVO is supported. 615 | */ 616 | @property(nonatomic) BOOL enableHardwareDecoder; 617 | 618 | /** 619 | @brief 设置是否循环播放,支持KVO 620 | */ 621 | /**** 622 | @brief Enable or disable loop playback. KVO is supported. 623 | */ 624 | @property(nonatomic, getter=isLoop) BOOL loop; 625 | 626 | /** 627 | @brief 设置是否自动播放,支持KVO 628 | */ 629 | /**** 630 | @brief Enable or disable autoplay. KVO is supported. 631 | */ 632 | @property(nonatomic, getter=isAutoPlay) BOOL autoPlay; 633 | 634 | /** 635 | @brief 渲染镜像模式,支持KVO 636 | @see AVPMirrorMode 637 | */ 638 | /**** 639 | @brief Set a mirroring mode. KVO is supported. 640 | @see AVPMirrorMode 641 | */ 642 | @property(nonatomic) AVPMirrorMode mirrorMode; 643 | 644 | /** 645 | @brief 渲染旋转模式,支持KVO 646 | @see AVPRotateMode 647 | */ 648 | /**** 649 | @brief Set a rotate mode. KVO is supported. 650 | @see AVPRotateMode 651 | */ 652 | @property(nonatomic) AVPRotateMode rotateMode; 653 | 654 | /** 655 | @brief 渲染填充模式,支持KVO 656 | @see AVPScalingMode 657 | */ 658 | /**** 659 | @brief Set a zoom mode. KVO is supported. 660 | @see AVPScalingMode 661 | */ 662 | @property(nonatomic) AVPScalingMode scalingMode; 663 | 664 | 665 | /** 666 | @brief 设置播放器的视图playerView 667 | * AVPView: mac下为NSOpenGLView,iOS下为UIView 668 | */ 669 | /**** 670 | @brief Set a player view (playerView). 671 | * AVPView: Mac platform: NSOpenGLView. iOS platform: UIView. 672 | */ 673 | @property(nonatomic, strong) AVPView* playerView; 674 | 675 | /** 676 | @brief 获取视频的宽度,支持KVO 677 | */ 678 | /**** 679 | @brief Query the width of the video. KVO is supported. 680 | */ 681 | @property (nonatomic, readonly) int width; 682 | 683 | /** 684 | @brief 获取视频的高度,支持KVO 685 | */ 686 | /**** 687 | @brief Query the height of the video. KVO is supported. 688 | */ 689 | @property (nonatomic, readonly) int height; 690 | 691 | /** 692 | @brief 获取视频的旋转角度,从metadata中获取出来,支持KVO 693 | */ 694 | /**** 695 | @brief Query the rotate angle of the video, which is retrieved from the video metadata. KVO is supported. 696 | */ 697 | @property (nonatomic, readonly) int rotation; 698 | 699 | /** 700 | @brief 获取/设置播放器的音量(非系统音量),支持KVO,范围0.0~2.0,当音量大于1.0时,可能出现噪音,不推荐使用。 701 | */ 702 | /**** 703 | @brief Query or set the volume of the player(Not system volume). KVO is supported. The range is 0.0~2.0,it maybe lead to noise if set volume more then 1.0, not recommended. 704 | */ 705 | @property (nonatomic, assign) float volume; 706 | 707 | /** 708 | @brief 获取视频的长度,支持KVO 709 | */ 710 | /**** 711 | @brief Query the length of the video. KVO is supported. 712 | */ 713 | @property (nonatomic, readonly) int64_t duration; 714 | 715 | /** 716 | @brief 获取当前播放位置,支持KVO 717 | */ 718 | /**** 719 | @brief Query the current playback position. KVO is supported. 720 | */ 721 | @property (nonatomic, readonly) int64_t currentPosition; 722 | 723 | /** 724 | @brief 获取当前播放位置的utc时间,支持KVO 725 | */ 726 | /**** 727 | @brief Query the current playback utc time. KVO is supported. 728 | */ 729 | @property(nonatomic, readonly) int64_t currentUtcTime; 730 | 731 | 732 | /** 733 | @brief 获取当前播放命中的缓存文件大小,支持KVO 734 | */ 735 | /**** 736 | @brief Query the current playback cached file size. KVO is supported. 737 | */ 738 | @property(nonatomic, readonly) int64_t localCacheLoadedSize; 739 | 740 | /** 741 | @brief 获取当前下载速度,支持KVO 742 | */ 743 | /**** 744 | @brief Query the current download speed. KVO is supported. 745 | */ 746 | @property(nonatomic, readonly) int64_t currentDownloadSpeed; 747 | 748 | /** 749 | @brief 获取已经缓存的位置,支持KVO 750 | */ 751 | /**** 752 | @brief Query the buffered position. KVO is supported. 753 | */ 754 | @property (nonatomic, readonly) int64_t bufferedPosition; 755 | 756 | /** 757 | @brief 设置代理,参考AVPDelegate 758 | @see AVPDelegate 759 | */ 760 | /**** 761 | @brief Set a proxy. See AVPDelegate. 762 | @see AVPDelegate 763 | */ 764 | @property (nonatomic, weak) id delegate; 765 | 766 | /** 767 | @brief 设置渲染回调。废弃,使用renderingDelegate。 768 | */ 769 | /**** 770 | @brief Set the render callback. Deprecated, use the renderingDelegate. 771 | */ 772 | @property(nonatomic, weak) id renderDelegate __deprecated; 773 | 774 | /** 775 | @brief 设置渲染回调。 776 | */ 777 | /**** 778 | @brief Set the render callback. 779 | */ 780 | @property(nonatomic, weak) id renderingDelegate; 781 | /** 782 | @brief 设置埋点事件回调。 783 | */ 784 | /**** 785 | @brief Set the event report callback. 786 | */ 787 | @property (nonatomic, weak) id eventReportParamsDelegate; 788 | 789 | /** 790 | @brief 设置画中画的回调。 791 | */ 792 | /** 793 | @brief Set the picture in picture callback. 794 | */ 795 | @property (nonatomic, weak) id pictureInPictureDelegate; 796 | 797 | /** 798 | @brief 设置AudioSession的Delegate 799 | @param delegate Delegate对象 800 | */ 801 | /**** 802 | @brief Set AudioSession Delegate 803 | @param delegate the Delegate 804 | */ 805 | + (void)setAudioSessionDelegate:(id)delegate; 806 | 807 | /** 808 | @brief 是否打开log输出 809 | @param enableLog true表示输出log 810 | @see 使用setLogCallbackInfo 811 | */ 812 | /**** 813 | @brief Enable or disable logging. 814 | @param enableLog set as true to output log 815 | @see Use setLogCallbackInfo. 816 | */ 817 | +(void)setEnableLog:(BOOL)enableLog; 818 | 819 | /** 820 | @brief 设置日志打印回调block,异步 821 | @param logLevel log输出级别 822 | @param callbackBlock log回调block,可以为nil 823 | */ 824 | /**** 825 | @brief Set a log output callback block. Asynchronous. 826 | @param logLevel The level of the log. 827 | @param callbackBlock Log output callback block, which can be nil. 828 | */ 829 | +(void) setLogCallbackInfo:(AVPLogLevel)logLevel callbackBlock:(void (^)(AVPLogLevel logLevel,NSString* strLog))block; 830 | 831 | /** 832 | @brief 设置校验AVPStsInfo是否过期回调 833 | @param callback 834 | */ 835 | /**** 836 | @brief Set the AVPStsInfo expiration callback 837 | @param callback 838 | */ 839 | -(void) setVerifyStsCallback:(AVPStsStatus (^)(AVPStsInfo info)) callback; 840 | /** 841 | @brief 设置期望使用的播放器名字。 842 | @param name 期望使用的播放器名字 843 | */ 844 | /**** 845 | @brief Set preper player name. 846 | @param name preper player name. 847 | */ 848 | - (void)setPreferPlayerName:(NSString *)name; 849 | /** 850 | @brief 获取播放时使用的播放器名字 851 | */ 852 | /**** 853 | @brief Get used player name 854 | */ 855 | - (NSString *)getPlayerName; 856 | 857 | /** 858 | @brief 设置视频标签。值范围[0,99]。 859 | */ 860 | /**** 861 | @brief Set the video tags. Values range from [0,99]. 862 | */ 863 | - (void)setVideoTag:(int *)tags size:(int)size; 864 | 865 | /** 866 | @brief 发送用户自定义事件,将通过AVPEventReportParamsDelegate回调。事件 e = 5001。 867 | */ 868 | /**** 869 | @brief Send custom event, will callback through AVPEventReportParamsDelegate. Event id e = 5001. 870 | */ 871 | - (void)sendCustomEvent:(NSString *)args; 872 | 873 | 874 | /** 875 | @brief 重连所有网络连接,网络路由发生变化后,调用此接口,可以让播放器所有的连接切换到新的路由上去。 876 | */ 877 | /**** 878 | @brief reconnect all connections, call this when netWork router changed, and the player will use new router. 879 | */ 880 | 881 | + (void)netWorkReConnect; 882 | 883 | /** 884 | @brief 设置画中画功能开启/关闭 (目前播放器自带的画中画功能需要iOS15以上的系统,如果其他系统,可以通过播放器CicadaRenderingDelegate返回的pixelbuffer来自定义实现) 885 | */ 886 | /** 887 | @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) 888 | */ 889 | - (void)setPictureInPictureEnable:(BOOL)enable; 890 | 891 | @end 892 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AliPlayerGlobalSettings.h: -------------------------------------------------------------------------------- 1 | // 2 | // AliPlayerGlobalSettings.h 3 | // AliPlayerGlobalSettings 4 | // 5 | // Created by huang_jiafa on 2020/04/09. 6 | // Copyright © 2020 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #import "AVPDef.h" 10 | #import 11 | 12 | OBJC_EXPORT 13 | @interface AliPlayerGlobalSettings : NSObject 14 | 15 | /** 16 | @brief 设置域名对应的解析ip 17 | @param host 域名,需指定端口(http默认端口80,https默认端口443)。例如player.alicdn.com:443 18 | @param ip 相应的ip,设置为空字符串清空设定。 19 | */ 20 | /**** 21 | @brief Set a DNS ip to resolve the host. 22 | @param host The host. Need to specify the port (http defualt port is 80,https default port is 443). E.g player.alicdn.com:443 23 | @param ip The ip address, set as empty string to clear the setting. 24 | */ 25 | +(void)setDNSResolve:(NSString *)host ip:(NSString *)ip; 26 | 27 | /** 28 | @brief 设置解析ip类型 29 | @param type 解析ip的类型 30 | */ 31 | /**** 32 | @brief Set a IP type when resolve the host. 33 | @param type The IP type. 34 | */ 35 | +(void)setIpResolveType:(AVPIpResolveType)type; 36 | 37 | /** 38 | @brief 设置是否使用http2。 39 | @param use 40 | */ 41 | /**** 42 | @brief Set use http2 or not。 43 | @param use 44 | */ 45 | + (void)setUseHttp2:(bool)use; 46 | 47 | /** 48 | @brief 设置fairPlay的用户证书id, 每次设置必须在同一个线程,否则无法更新 49 | @param certID 用户证书id 50 | */ 51 | /**** 52 | @brief Set the .fairPlay certID, update the certID must use the thread first set 53 | @param type The IP type. 54 | */ 55 | +(void)setFairPlayCertID:(NSString *)certID; 56 | 57 | /** 58 | @brief 设置是否使能硬件提供的音频变速播放能力,关闭后则使用软件实现音频的倍速播放,pcm回调数据的格式和此设置关联,如果修改,请在同一个线程操作,默认打开 59 | */ 60 | /**** 61 | @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. 62 | */ 63 | + (void)enableHWAduioTempo:(bool)enable; 64 | 65 | 66 | /** 67 | @brief 强制音频渲染器采用指定的格式进行渲染,如果设定的格式设备不支持,则无效,无效值将被忽略,使用默认值;pcm回调数据的格式和此设置关联,如果修改,请在同一个线程操作,默认关闭 68 | @param force 打开/关闭 强制设置 69 | @param fmt 设置pcm的格式,目前只支持s16,16位有符号整数 70 | @param channels 设置pcm的声道数,有效值 1~8 71 | @param sample_rate 设置pcm的采样率,有效值 1~48000 72 | */ 73 | /**** 74 | @brief force audio render use the particular format,the value will no effect when the format not supported by device,the out range value will be ignored,and use the default value; 75 | and it will affect the pcm data that from audio rending callback, it only can be reset in the same thread, disabled by default. 76 | 77 | @param force enable/disable 78 | @param fmt the pcm format, only support s16 for now, signed integer with 16 bits 79 | @param channels the pcm channels, available range 1~8 80 | @param sample_rate set the pcm sample rate, available range 1~48000 81 | */ 82 | 83 | + (void)forceAudioRendingFormat:(bool)force fmt:(NSString *)fmt channels:(int)channels sample_rate:(int)sample_rate; 84 | 85 | /** 86 | @brief 开启本地缓存,开启之后,就会缓存到本地文件中。 87 | @param enable true:开启本地缓存。false:关闭。默认关闭。 88 | @param maxBufferMemoryKB 设置单个源的最大内存占用大小。单位KB 89 | @param localCacheDir 本地缓存的文件目录,绝对路径 90 | */ 91 | /**** 92 | @brief Enable local cache. When enabled, it will be cached in local files. 93 | @param enable true: enables the local cache. false: disable. This function is disabled by default. 94 | @param maxBufferMemoryKB Set the maximum memory size for a single source. Unit is KB 95 | @param localCacheDir Directory of files cached locally, absolute path 96 | */ 97 | + (void)enableLocalCache:(bool)enable maxBufferMemoryKB:(int)maxBufferMemoryKB localCacheDir:(NSString *)localCacheDir; 98 | 99 | /** 100 | @brief 本地缓存文件自动清理相关的设置 101 | @param expireMin 缓存多久过期:单位分钟,默认值30天,过期的缓存不管容量如何,都会在清理时淘汰掉; 102 | @param maxCapacityMB 最大缓存容量:单位兆,默认值20GB,在清理时,如果缓存总大小超过此大小,会以cacheItem为粒度,按缓存的最后时间排序,一个一个淘汰掉一些缓存,直到小于等于最大缓存容量; 103 | @param freeStorageMB 磁盘最小空余容量:单位兆,默认值0,在清理时,同最大缓存容量,如果当前磁盘容量小于该值,也会按规则一个一个淘汰掉一些缓存,直到freeStorage大于等于该值或者所有缓存都被干掉; 104 | */ 105 | /**** 106 | @brief Settings related to automatic clearing of local cache files 107 | @param expireMin How long the cache expires: the unit is minute. The default value is 30 days. 108 | @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. 109 | @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. 110 | */ 111 | + (void)setCacheFileClearConfig:(int64_t)expireMin maxCapacityMB:(int64_t)maxCapacityMB freeStorageMB:(int64_t)freeStorageMB; 112 | 113 | /** 114 | @brief 回调方法 115 | @param url 视频url 116 | @return hash值,必须要保证每个url都不一样 117 | */ 118 | /**** 119 | @brief callback 120 | @param url the loaded URL 121 | @return the hash value . Ensure that each URL is different. 122 | */ 123 | typedef NSString *(*CaheUrlHashCallback)(NSString *url); 124 | 125 | /** 126 | @brief 设置加载url的hash值回调。如果不设置,SDK使用md5算法。 127 | */ 128 | /**** 129 | @brief Sets the hash callback to load the URL. If this parameter is not set, the SDK uses md5 algorithm. 130 | */ 131 | + (void)setCacheUrlHashCallback:(CaheUrlHashCallback)callback; 132 | 133 | /** 134 | @brief 是否开启httpDNS。默认不开启。 135 | @param enable 136 | */ 137 | /**** 138 | @brief enable httpDNS. Default is disabled. 139 | @param enable 140 | */ 141 | + (void)enableHttpDns:(BOOL)enable; 142 | 143 | /** 144 | @brief 是否开启内建预加载网络平衡策略,播放过程中,自动控制预加载的运行时机。默认开启。 145 | @param enable 146 | */ 147 | /**** 148 | @brief enable Network Balance mechanism for control media loader's scheduling automatically. Default is enabled. 149 | @param enable 150 | */ 151 | + (void)enableNetworkBalance:(BOOL)enable; 152 | 153 | /** 154 | @brief 是否开启缓冲buffer到本地缓存,开启后,如果maxBufferDuration大于50s,则大于50s到部分会缓存到本地缓存。默认关闭。 155 | @param enable 156 | */ 157 | /**** 158 | @brief enable buffer to local cache when maxBufferDuration large than 50s. Default is enabled. 159 | @param enable 160 | */ 161 | + (void)enableBufferToLocalCache:(BOOL)enable; 162 | 163 | + (void) clearCaches; 164 | 165 | @end 166 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AliPlayerPictureInPictureDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AliPlayerPictureInPictureDelegate.h 3 | // AliyunPlayer 4 | // 5 | // Created by alibaba on 2022/7/4. 6 | // Copyright © 2022 com.alibaba.AliyunPlayer. All rights reserved. 7 | 8 | #ifndef AliPlayerPictureInPictureDelegate_h 9 | #define AliPlayerPictureInPictureDelegate_h 10 | 11 | #import 12 | #if TARGET_OS_IPHONE 13 | #import 14 | #elif TARGET_OS_OSX 15 | #import 16 | #endif 17 | 18 | @protocol AliPlayerPictureInPictureDelegate 19 | 20 | @optional 21 | 22 | /** 23 | * 画中画准备启动 24 | */ 25 | - (void)pictureInPictureControllerWillStartPictureInPicture; 26 | 27 | /** 28 | * 画中画已经启动 29 | */ 30 | - (void)pictureInPictureControllerDidStartPictureInPicture; 31 | 32 | /** 33 | * 画中画准备停止 34 | */ 35 | - (void)pictureInPictureControllerWillStopPictureInPicture; 36 | 37 | /** 38 | * 画中画已经停止 39 | */ 40 | - (void)pictureInPictureControllerDidStopPictureInPicture; 41 | 42 | /** 43 | * 画中画返回app界面,后是否要停止 44 | */ 45 | - (BOOL)pictureInPictureIsPlaybackPaused; 46 | 47 | @end 48 | 49 | 50 | 51 | #endif /* AliPlayerPictureInPictureDelegate_h */ 52 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AliPrivateService.h: -------------------------------------------------------------------------------- 1 | // 2 | // AliPrivateService.h 3 | // AliPrivateService 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | OBJC_EXPORT 12 | @interface AliPrivateService : NSObject 13 | 14 | /** 15 | @brief 初始化下载秘钥信息 16 | @param datFile 秘钥文件的路径 17 | */ 18 | /**** 19 | @brief Initialize the credential for downloading resources. 20 | @param datFile The path of the credential file. 21 | */ 22 | + (void)initKey:(NSString*)datFile; 23 | 24 | /** 25 | @brief 初始化下载秘钥信息 26 | @param data 秘钥文件的内容 27 | */ 28 | /**** 29 | @brief Initialize the credential for downloading resources. 30 | @param data The data of the credential file. 31 | */ 32 | + (void)initKeyWithData:(NSData*)data; 33 | 34 | /** 35 | @brief 初始化证书服务 36 | @param key 用户拥有的licenseKey信息 37 | @param licensePath 本地证书路径 38 | @param storageDir 下载证书文件夹路径 39 | */ 40 | /**** 41 | @brief Initialize the license service. 42 | @param key license key that user have 43 | @param licensePath local license file path 44 | @param storageDir download license file folder path 45 | */ 46 | + (void)initLicenseService; 47 | @end 48 | 49 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AliVodMediaLoader.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | 5 | @class AVPMediaInfo; 6 | @class AVPVidStsSource; 7 | @class AVPVidAuthSource; 8 | 9 | 10 | @protocol AliVodMediaLoaderStatusDelegate 11 | @optional 12 | 13 | /** 14 | @brief 准备完成 15 | */ 16 | - (void)onPrepared:(AVPMediaInfo *)mediaInfo; 17 | 18 | /** 19 | @brief 错误回调 20 | @param url 加载url 21 | @param code 错误码 22 | @param msg 错误描述 23 | */ 24 | - (void)onError:(NSString *)vid index:(int)index code:(int64_t)code msg:(NSString *)msg; 25 | 26 | /** 27 | @brief 完成回调 28 | @param url 加载url 29 | */ 30 | - (void)onCompleted:(NSString *)vid index:(int)index; 31 | 32 | /** 33 | @brief 取消回调 34 | @param url 加载url 35 | */ 36 | - (void)onCanceled:(NSString *)vid index:(int)index; 37 | 38 | @end 39 | 40 | 41 | OBJC_EXPORT 42 | @interface AliVodMediaLoader : NSObject 43 | 44 | + (instancetype)shareInstance; 45 | 46 | - (void)prepareVidStsSource:(AVPVidStsSource *)stsSource; 47 | 48 | - (void)prepareVidAuthSource:(AVPVidAuthSource *)authSource; 49 | 50 | - (void)removeVidSource:(NSString *)vid; 51 | 52 | /** 53 | @brief 开始加载文件。异步加载。可以同时加载多个。 54 | @param url 视频文件地址 55 | @param duration 加载的时长大小.单位:毫秒 56 | */ 57 | - (void)load:(NSString *)vid index:(int)index duration:(int64_t)duration; 58 | 59 | /** 60 | @brief 取消加载。注意:不会删除已经下载的文件。 61 | @param url 视频文件地址 。为nil或者空,则取消全部。 62 | */ 63 | - (void)cancel:(NSString *)vid index:(int)index; 64 | 65 | /** 66 | @brief 暂停加载。 67 | @param url 视频文件地址。 为nil或者空,则暂停全部。 68 | */ 69 | - (void)pause:(NSString *)vid index:(int)index; 70 | 71 | /** 72 | @brief 恢复加载。 73 | @param url 视频文件地址。 为nil或者空,则恢复全部。 74 | */ 75 | - (void)resume:(NSString *)vid index:(int)index; 76 | 77 | /** 78 | @brief 设置状态代理,参考AliMediaLoaderStatusDelegate 79 | @see AliMediaLoaderStatusDelegate 80 | */ 81 | - (void)setAliVodMediaLoaderStatusDelegate:(id)delegate; 82 | @end 83 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/AliyunPlayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // AliPlayerHeader.h 3 | // AliPlayerHeader 4 | // 5 | // Created by shiping.csp on 2018/12/3. 6 | // Copyright © 2018 shiping.csp. All rights reserved. 7 | // 8 | 9 | //! Project version number for AliPlayerHeader. 10 | //FOUNDATION_EXPORT double AliPlayerHeaderVersionNumber; 11 | 12 | //! Project version string for AliPlayerHeader. 13 | //FOUNDATION_EXPORT const unsigned char AliPlayerHeaderVersionString[]; 14 | 15 | // In this header, you should import all the public headers of your framework using statements like #import 16 | 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | //#import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | #import 37 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/CicadaAudioSessionDelegate.h: -------------------------------------------------------------------------------- 1 | #ifndef CicadaAudioSessionDelegate_h 2 | #define CicadaAudioSessionDelegate_h 3 | 4 | #import 5 | #import 6 | 7 | @protocol CicadaAudioSessionDelegate 8 | #if TARGET_OS_IPHONE 9 | @optional 10 | - (BOOL)setActive:(BOOL)active error:(NSError **)outError; 11 | 12 | @optional 13 | - (BOOL)setCategory:(NSString *)category withOptions:(AVAudioSessionCategoryOptions)options error:(NSError **)outError; 14 | 15 | @optional 16 | - (BOOL)setCategory:(AVAudioSessionCategory)category mode:(AVAudioSessionMode)mode routeSharingPolicy:(AVAudioSessionRouteSharingPolicy)policy options:(AVAudioSessionCategoryOptions)options error:(NSError **)outError; 17 | #endif 18 | @end 19 | 20 | #endif /* CicadaAudioSessionDelegate_h */ 21 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/CicadaFrameInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CicadaFrameInfo_h 3 | #define CicadaFrameInfo_h 4 | 5 | #import 6 | #import 7 | 8 | typedef enum CicadaFrameType : NSUInteger{ 9 | Cicada_FrameType_Unknown, 10 | Cicada_FrameType_Video, 11 | Cicada_FrameType_Audio 12 | } CicadaFrameType; 13 | 14 | typedef enum CicadaSampleFormat : NSInteger { 15 | CICADA_SAMPLE_FMT_NONE = -1, 16 | CICADA_SAMPLE_FMT_U8, ///< unsigned 8 bits 17 | CICADA_SAMPLE_FMT_S16, ///< signed 16 bits 18 | CICADA_SAMPLE_FMT_S32, ///< signed 32 bits 19 | CICADA_SAMPLE_FMT_FLT, ///< float 20 | CICADA_SAMPLE_FMT_DBL, ///< double 21 | 22 | CICADA_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar 23 | CICADA_SAMPLE_FMT_S16P, ///< signed 16 bits, planar 24 | CICADA_SAMPLE_FMT_S32P, ///< signed 32 bits, planar 25 | CICADA_SAMPLE_FMT_FLTP, ///< float, planar 26 | CICADA_SAMPLE_FMT_DBLP, ///< double, planar 27 | 28 | CICADA_SAMPLE_FMT_NB, ///< Number of sample formats. DO NOT USE if linking dynamically 29 | 30 | } CicadaSampleFormat; 31 | 32 | typedef enum CicadaPixelFormat : NSInteger { 33 | CICADA_PIX_FMT_NONE = -1, 34 | CICADA_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) 35 | CICADA_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr 36 | CICADA_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... 37 | CICADA_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... 38 | CICADA_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) 39 | CICADA_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) 40 | CICADA_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) 41 | CICADA_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) 42 | CICADA_PIX_FMT_GRAY8, ///< Y , 8bpp 43 | CICADA_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each 44 | ///< byte pixels are ordered from the msb to the lsb 45 | CICADA_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each 46 | ///< byte pixels are ordered from the msb to the lsb 47 | CICADA_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette 48 | CICADA_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in 49 | ///< favor of AV_PIX_FMT_YUV420P and setting color_range 50 | CICADA_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in 51 | ///< favor of AV_PIX_FMT_YUV422P and setting color_range 52 | CICADA_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in 53 | ///< favor of AV_PIX_FMT_YUV444P and setting color_range 54 | CICADA_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 55 | CICADA_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 56 | CICADA_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) 57 | CICADA_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a 58 | ///< byte contains two pixels, the first pixel in the byte is the 59 | ///< one composed by the 4 msb bits 60 | CICADA_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) 61 | CICADA_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) 62 | CICADA_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a 63 | ///< byte contains two pixels, the first pixel in the byte is the 64 | ///< one composed by the 4 msb bits 65 | CICADA_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) 66 | CICADA_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the 67 | ///< UV components, which are interleaved (first byte U and the 68 | ///< following byte V) 69 | CICADA_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped 70 | 71 | CICADA_PIX_FMT_YUV420P10BE = 63, ///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb 72 | ///< sample per 2x2 Y samples), big-endian 73 | CICADA_PIX_FMT_YUV420P10LE, ///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb 74 | ///< sample per 2x2 Y samples), little-endian 75 | 76 | CICADA_PIX_FMT_D3D11 = 900, 77 | CICADA_PIX_FMT_DXVA2_VLD, 78 | 79 | CICADA_PIX_FMT_APPLE_PIXEL_BUFFER = 1000, 80 | CICADA_PIX_FMT_CICADA_AF, // framework VideoFrame 81 | CICADA_PIX_FMT_CICADA_MEDIA_CODEC, // Android mediacodec buffer index 82 | 83 | } CicadaPixelFormat; 84 | 85 | OBJC_EXPORT 86 | @interface CicadaFrameInfo : NSObject 87 | 88 | @property(nonatomic, assign) CicadaFrameType frameType; 89 | @property(nonatomic, assign) long pts; 90 | @property(nonatomic, assign) long duration; 91 | @property(nonatomic, assign) BOOL key; 92 | @property(nonatomic, assign) long timePosition; 93 | 94 | @property(nonatomic, assign) CicadaSampleFormat audio_format; 95 | @property(nonatomic, assign) int audio_nb_samples; 96 | @property(nonatomic, assign) int audio_channels; 97 | @property(nonatomic, assign) int audio_sample_rate; 98 | @property(nonatomic, assign) uint64_t audio_channel_layout; 99 | @property(nonatomic, assign) int audio_data_lineNum; 100 | @property(nonatomic, assign) uint8_t ** audio_data; 101 | @property(nonatomic, assign) int audio_data_lineSize; 102 | 103 | 104 | @property(nonatomic, assign) CicadaPixelFormat video_format; 105 | @property(nonatomic, assign) int video_width; 106 | @property(nonatomic, assign) int video_height; 107 | @property(nonatomic, assign) int video_rotate; 108 | @property(nonatomic, assign) double video_dar; 109 | @property(nonatomic, assign) size_t video_crop_top; 110 | @property(nonatomic, assign) size_t video_crop_bottom; 111 | @property(nonatomic, assign) size_t video_crop_left; 112 | @property(nonatomic, assign) size_t video_crop_right; 113 | @property(nonatomic, assign) int video_colorRange; 114 | @property(nonatomic, assign) int video_colorSpace; 115 | @property(nonatomic, assign) int video_data_lineNum; 116 | @property(nonatomic, assign) int* video_data_lineSize; 117 | @property(nonatomic, assign) uint8_t ** video_data_addr; 118 | @property(nonatomic, assign) CVPixelBufferRef video_pixelBuffer; 119 | 120 | @property(nonatomic, assign) int sei_type; 121 | @property(nonatomic, assign) char *sei_data; 122 | @property(nonatomic, assign) int sei_data_size; 123 | 124 | @end 125 | 126 | 127 | #endif /* CicadaFrameInfo_h */ 128 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/CicadaRenderDelegate.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @protocol CicadaRenderDelegate 5 | @optional 6 | 7 | /** 8 | * 视频硬解渲染帧回调 9 | * @param pixelBuffer 渲染帧 10 | * @param pts 渲染帧pts 11 | * @return 返回YES则SDK不再显示(暂不支持);返回NO则SDK渲染模块继续渲染 12 | */ 13 | - (BOOL)onVideoPixelBuffer:(CVPixelBufferRef)pixelBuffer pts:(int64_t)pts; 14 | 15 | /** 16 | * 视频软解渲染帧回调 17 | * @param pixelBuffer 渲染帧 18 | * @param pts 渲染帧pts 19 | * @return 返回YES则SDK不再显示(暂不支持);返回NO则SDK渲染模块继续渲染 20 | */ 21 | - (BOOL)onVideoRawBuffer:(uint8_t **)buffer lineSize:(int32_t *)lineSize pts:(int64_t)pts width:(int32_t)width height:(int32_t)height; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/CicadaRenderingDelegate.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @class CicadaFrameInfo; 5 | 6 | @protocol CicadaRenderingDelegate 7 | @optional 8 | 9 | - (BOOL)onRenderingFrame:(CicadaFrameInfo*) frameInfo; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Headers/VidPlayerConfigGen.h: -------------------------------------------------------------------------------- 1 | // 2 | // VidPlayerConfigGen.h 3 | // AliPlayerSDK 4 | // 5 | // Created by shiping.csp on 2018/11/16. 6 | // Copyright © 2018 com.alibaba.AliyunPlayer. All rights reserved. 7 | // 8 | 9 | #ifndef VidPlayerConfigGen_h 10 | #define VidPlayerConfigGen_h 11 | 12 | #import 13 | 14 | OBJC_EXPORT 15 | @interface VidPlayerConfigGenerator : NSObject 16 | 17 | /** 18 | @brief 设置预览时间 19 | @param previewTime 预览时间,单位为秒 20 | */ 21 | /**** 22 | @brief Set the preview duration. 23 | @param previewTime The specified preview duration in seconds. 24 | */ 25 | -(void) setPreviewTime:(int)previewTime; 26 | 27 | /** 28 | @brief HLS标准加密设置UriToken 29 | @param MtsHlsUriToken 字符串 30 | */ 31 | /**** 32 | @brief Set a UriToken for HLS standard encryption. 33 | @param MtsHlsUriToken The UriToken. 34 | */ 35 | -(void) setHlsUriToken:(NSString*)MtsHlsUriToken; 36 | 37 | /** 38 | @brief 添加vid的playerconfig参数 39 | @param key: 对应playerConfig中的参数名字 40 | @param value: 对应key参数的值 41 | */ 42 | /**** 43 | @brief Add a playerconfig parameter for the specified VID. 44 | @param key: The name of the playerConfig parameter. 45 | @param value: The value of the parameter. 46 | */ 47 | -(void) addVidPlayerConfigByStringValue:(NSString*)key value:(NSString*)value; 48 | 49 | /** 50 | @brief 添加vid的playerconfig参数 51 | @param key: 对应playerConfig中的参数名字 52 | @param value: 对应key参数的整形值 53 | */ 54 | /**** 55 | @brief Add a playerconfig parameter for the specified VID. 56 | @param key: The name of the playerConfig parameter. 57 | @param value: The value of the parameter. 58 | */ 59 | -(void) addVidPlayerConfigByIntValue:(NSString*)key value:(int)value; 60 | 61 | 62 | /** 63 | @brief 生成playerConfig 64 | */ 65 | /**** 66 | @brief Generate playerConfig. 67 | */ 68 | -(NSString*) generatePlayerConfig; 69 | 70 | @end 71 | 72 | #endif /* VidPlayerConfigGen_h */ 73 | -------------------------------------------------------------------------------- /AliyunPlayer.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/AliyunPlayer.framework/Info.plist -------------------------------------------------------------------------------- /AliyunPlayer.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module AliyunPlayer { 2 | umbrella header "AliyunPlayer.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | 3 | Copyright (c) 2017 Alien inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AliPlayer_iOS 2 | 3 | # 功能使用 4 | 5 | 阿里云SDK提供了以下几大功能: 6 | 7 | - 单个视频播放功能 8 | - 视频列表播放功能 9 | - 下载视频功能 10 | - 缓存功能 11 | 12 | 功能具体介绍如下。 13 | 14 | 15 | ## 一. 播放功能 16 | 17 | 播放功能的基本流程如下: 18 | 19 | 创建播放器->设置事件监听->创建播放源->准备播放器->准备成功后开始播放->播放控制->释放播放器。 20 | 21 | 22 | ### 1.创建播放器 23 | 24 | 可以创建两种播放器:AliPlayer和AliListPlayer。
AliListPlayer比AliPlayer多了列表播放的功能,其余功能是一致的。使用方法如下: 25 | 26 | ```objectivec 27 | self.player = [[AliPlayer alloc] init]; 28 | self.listPlayer = [[AliListPlayer alloc] init]; 29 | ``` 30 | 31 | 如果播放的视频是安全下载后的本地文件(即经过阿里云`加密转码`过后的),那么还需要设置一个加密校验信息(建议在Application中配置一次即可): 32 | 33 | ```objectivec 34 | NSString *encrptyFilePath = [[NSBundle mainBundle] pathForResource:@"encryptedApp" ofType:@"dat"]; 35 | [AliPrivateService initKey:encrptyFilePath]; 36 | ``` 37 | 38 | 如果没有设置正确的校验文件,播放安全下载后的文件会报错:ERROR_DEMUXER_OPENSTREAM。 39 | 40 | 41 | ### 2.设置播放器Delegate 42 | 43 | 播放器提供了Delegate回调,比如:onPlayerEvent,onError等事件。使用方法如下: 44 | 45 | ``` 46 | @interface SimplePlayerViewController () 47 | @end 48 | 49 | - (void)viewDidLoad { 50 | self.player = [[AliPlayer alloc] init]; 51 | self.player.playerView = self.avpPlayerView.playerView; 52 | self.player.delegate = self; 53 | //... 54 | } 55 | 56 | /** 57 | @brief 错误代理回调 58 | @param player 播放器player指针 59 | @param errorModel 播放器错误描述,参考AliVcPlayerErrorModel 60 | */ 61 | - (void)onError:(AliPlayer*)player errorModel:(AVPErrorModel *)errorModel { 62 | //提示错误,及stop播放 63 | } 64 | 65 | /** 66 | @brief 播放器事件回调 67 | @param player 播放器player指针 68 | @param eventType 播放器事件类型,@see AVPEventType 69 | */ 70 | -(void)onPlayerEvent:(AliPlayer*)player eventType:(AVPEventType)eventType { 71 | switch (eventType) { 72 | case AVPEventPrepareDone: { 73 | // 准备完成 74 | } 75 | break; 76 | case AVPEventAutoPlayStart: 77 | // 自动播放开始事件 78 | break; 79 | case AVPEventFirstRenderedStart: 80 | // 首帧显示 81 | break; 82 | case AVPEventCompletion: 83 | // 播放完成 84 | break; 85 | case AVPEventLoadingStart: 86 | // 缓冲开始 87 | break; 88 | case AVPEventLoadingEnd: 89 | // 缓冲完成 90 | break; 91 | case AVPEventSeekEnd: 92 | // 跳转完成 93 | break; 94 | case AVPEventLoopingStart: 95 | // 循环播放开始 96 | break; 97 | default: 98 | break; 99 | } 100 | } 101 | 102 | /** 103 | @brief 视频当前播放位置回调 104 | @param player 播放器player指针 105 | @param position 视频当前播放位置 106 | */ 107 | - (void)onCurrentPositionUpdate:(AliPlayer*)player position:(int64_t)position { 108 | // 更新进度条 109 | } 110 | 111 | /** 112 | @brief 视频缓存位置回调 113 | @param player 播放器player指针 114 | @param position 视频当前缓存位置 115 | */ 116 | - (void)onBufferedPositionUpdate:(AliPlayer*)player position:(int64_t)position { 117 | // 更新缓冲进度 118 | } 119 | 120 | /** 121 | @brief 获取track信息回调 122 | @param player 播放器player指针 123 | @param info track流信息数组 参考AVPTrackInfo 124 | */ 125 | - (void)onTrackReady:(AliPlayer*)player info:(NSArray*)info { 126 | // 获取多码率信息 127 | } 128 | 129 | /** 130 | @brief 字幕显示回调 131 | @param player 播放器player指针 132 | @param index 字幕显示的索引号 133 | @param subtitle 字幕显示的字符串 134 | */ 135 | - (void)onSubtitleShow:(AliPlayer*)player index:(int)index subtitle:(NSString *)subtitle { 136 | // 获取字幕进行显示 137 | } 138 | 139 | /** 140 | @brief 字幕隐藏回调 141 | @param player 播放器player指针 142 | @param index 字幕显示的索引号 143 | */ 144 | - (void)onSubtitleHide:(AliPlayer*)player index:(int)index { 145 | // 隐藏字幕 146 | } 147 | 148 | /** 149 | @brief 获取截图回调 150 | @param player 播放器player指针 151 | @param image 图像 152 | */ 153 | - (void)onCaptureScreen:(AliPlayer *)player image:(UIImage *)image { 154 | // 预览,保存截图 155 | } 156 | 157 | /** 158 | @brief track切换完成回调 159 | @param player 播放器player指针 160 | @param info 切换后的信息 参考AVPTrackInfo 161 | */ 162 | - (void)onTrackChanged:(AliPlayer*)player info:(AVPTrackInfo*)info { 163 | // 切换码率结果通知 164 | } 165 | 166 | //... 167 | ``` 168 | 169 | > 具体回调参数的详细说明,参看接口文档。 170 | 171 | 172 | 173 | ### 3. 创建DataSource,准备播放 174 | 175 | 播放器支持4种播放源:AVPVidStsSource,AVPVidAuthSource,AVPVidMpsSource,AVPUrlSource。其中AVPUrlSource是直接的url播放,其余的三种是通过vid进行播放:AVPVidStsSource推荐点播用户使用;AVPVidAuthSource不建议使用;AVPVidMpsSource仅限MPS用户使用。 176 | 177 | 以VidSts举例,使用方式如下: 178 | 179 | ```objectivec 180 | //创建VidSts 181 | AVPVidStsSource *source = [[AVPVidStsSource alloc] init]; 182 | source.region = self.接入区域; 183 | source.vid = self.视频vid; 184 | source.securityToken = self.安全token; 185 | source.accessKeySecret = self.临时akSecret; 186 | source.accessKeyId = self.临时akId; 187 | //设置播放源 188 | [self.player setStsSource:source]; 189 | //准备播放 190 | [self.player prepare]; 191 | 192 | ``` 193 | 194 | > MPS视频播放的流程与概念,[参考这里](https://help.aliyun.com/document_detail/53522.html) 195 | > 通过播放凭证VidAuth播放的流程,[参考这里](https://help.aliyun.com/document_detail/57294.html) 196 | > 接入区域Region的设置,参考 [点播中心和访问域名](https://help.aliyun.com/document_detail/98194.html) 197 | 198 | 199 | 200 | ### 4. 设置显示的view 201 | 202 | 如果源有画面,那么需要设置显示的view到播放器中,用来显示画面。 203 | 204 | ```objectivec 205 | self.player.playerView = self.avpPlayerView.playerView;//用户显示的view 206 | ``` 207 | 208 | 209 | ### 5. 播放控制 210 | 211 | 用户自行创建播放器的播放控制按钮,在按钮事件里面实现播放器控制接口。基本控制功能有播放、停止、暂停、拖动(seek),其中Seek功能仅对点播有效,直播使用暂停功能时会使画面停留在当前画面,使用恢复后会开始播放当前画面。使用示例如下: 212 | 213 | ```objectivec 214 | // 开始播放。 215 | [self.player start]; 216 | //暂停播放 217 | [self.player pause]; 218 | //停止播放 219 | [self.player stop]; 220 | // 跳转到。目前只支持不精准。 221 | [self.player seekToTime:position seekMode:AVP_SEEKMODE_INACCURATE]; 222 | // 重置 223 | [self.player reset]; 224 | //释放。释放后播放器将不可再被使用。 225 | [self.player destroy]; 226 | self.player = nil; 227 | ``` 228 | 229 | 230 | ### 6. 切换多码率 231 | 232 | 播放器SDK支持HLS多码率地址播放。在`prepare`成功之后,通过`getMediaInfo`可以获取到各个码流的信息,即`TrackInfo`。 233 | 234 | ```objectivec 235 | AVPMediaInfo *info = [self.player getMediaInfo]; 236 | NSArray* tracks = info.tracks; 237 | ``` 238 | 239 | 在播放过程中,可以通过调用播放器的`selectTrack`方法切换播放的码流。 240 | 241 | ```objectivec 242 | [self.player selectTrack:track.trackIndex]; 243 | ``` 244 | 245 | 切换的结果会在`onTrackChanged`回调: 246 | 247 | ```objectivec 248 | - (void)onTrackChanged:(AliPlayer*)player info:(AVPTrackInfo*)info { 249 | if (info.trackType == AVPTRACK_TYPE_VIDEO) { 250 | // video changed 251 | } 252 | // etc 253 | } 254 | ``` 255 | 256 | ### 7.自动播放 257 | 258 | 播放器SDK支持自动播放视频的设置。在`prepare`之前设置autoPlay。 259 | 260 | ```objectivec 261 | self.player.autoPlay = YES; 262 | ``` 263 | 264 | 设置自动播放之后,prepare成功之后,将会自动播放视频。但是注意:自动播放的时候将不会回调`AVPEventPrepareDone`回调,而会回调AVPEventAutoPlayStart回调。 265 | 266 | ```objectivec 267 | -(void)onPlayerEvent:(AliPlayer*)player eventType:(AVPEventType)eventType { 268 | switch (eventType) { 269 | case AVPEventPrepareDone: { 270 | break; 271 | case AVPEventAutoPlayStart: 272 | break; 273 | } 274 | } 275 | ``` 276 | 277 | 278 | ### 8.循环播放 279 | 280 | 播放器SDK提供了循环播放视频的功能。设置`loop`开启循环播放, 播放完成后,将会自动从头开始播放视频。 281 | 282 | ```objectivec 283 | self.player.loop = YES; 284 | ``` 285 | 286 | 同时循环开始的回调将会使用`AVPEventLoopingStart`中通知。 287 | 288 | 289 | ### 9.画面旋转、填充、镜像操作 290 | 291 | 播放器SDK提供过了多种设置,可以对画面进行精确的控制。包括设置画面旋转模式,设置画面缩放模式,设置镜像模式。 292 | 293 | ```objectivec 294 | //设置画面的镜像模式:水平镜像,垂直镜像,无镜像。 295 | self.player.mirrorMode = AVP_MIRRORMODE_NONE; 296 | //设置画面旋转模式:旋转0度,90度,180度,270度 297 | self.player.rotateMode = AVP_ROTATE_0; 298 | //设置画面缩放模式:宽高比填充,宽高比适应,拉伸填充 299 | self.player.scalingMode = AVP_SCALINGMODE_SCALEASPECTFIT; 300 | ``` 301 | 302 | 画面的旋转模式包括: 303 | 304 | | 值 | 说明 | 305 | | --- | --- | 306 | | AVP_ROTATE_0 | 顺时针旋转0度 | 307 | | AVP_ROTATE_90 | 顺时针旋转90度 | 308 | | AVP_ROTATE_180 | 顺时针旋转180度 | 309 | | AVP_ROTATE_270 | 顺时针旋转270度 | 310 | 311 | 312 | 画面的缩放模式包括: 313 | 314 | | 值 | 说明 | 315 | | --- | --- | 316 | | AVP_SCALINGMODE_SCALEASPECTFIT | 宽高比适应(将按照视频宽高比等比缩小到view内部,不会有画面变形) | 317 | | AVP_SCALINGMODE_SCALEASPECTFILL | 宽高比填充(将按照视频宽高比等比放大,充满view,不会有画面变形) | 318 | | AVP_SCALINGMODE_SCALETOFILL | 拉伸填充(如果视频宽高比例与view比例不一致,会导致画面变形) | 319 | 320 | 321 | 镜像模式包括: 322 | 323 | | 值 | 说明 | 324 | | --- | --- | 325 | | AVP_MIRRORMODE_NONE | 无镜像 | 326 | | AVP_MIRRORMODE_HORIZONTAL | 水平镜像 | 327 | | AVP_MIRRORMODE_VERTICAL | 垂直镜像 | 328 | 329 | 330 | 331 | ### 10.静音、音量控制 332 | 333 | 播放器SDK 提供了对视频的音量控制功能。设置muted播放器静音,设置`volume`控制音量大小,范围是0~1。 334 | 335 | ```objectivec 336 | //设置播放器静音 337 | self.player.muted = YES; 338 | //设置播放器音量,范围0~1. 339 | self.player.volume = 1.0f; 340 | ``` 341 | 342 | []() 343 | 344 | ### 11.倍数播放 345 | 346 | 播放器SDK 提供了倍数播放视频的功能,通过设置`rate`方法, 能够以0.5倍~2倍数去播放视频。同时保持变声不变调。 347 | 348 | ```objectivec 349 | //设置倍速播放:支持0.5~2倍速的播放 350 | self.player.rate = 1.0f; 351 | ``` 352 | 353 | []() 354 | 355 | ### 12.截图功能 356 | 357 | 播放器SDK提供了对当前视频截图的功能`snapshot`。截取的是原始的数据,并转为bitmap返回。回调接口为`onCaptureScreen`。 注意:截图是不包含界面的。 358 | 359 | ```objectivec 360 | //截图回调 361 | - (void)onCaptureScreen:(AliPlayer *)player image:(UIImage *)image { 362 | // 处理截图 363 | } 364 | 365 | //截取当前播放的画面 366 | aliyunVodPlayer.snapshot(); 367 | ``` 368 | 369 | []() 370 | 371 | ### 13. 边播边缓存 372 | 373 | 播放器SDK提供了边播边缓存的功能,能够让用户重复播放视频时,达到省流量的目的。只需在`prepare`之前给播放器配置`AVPCacheConfig`即可实现此功能。 374 | 375 | > 如果播放了加密视频,还需要一个加密校验文件的配置。参看【14. 配置加密校验文件】 376 | 377 | 378 | ```objectivec 379 | AVPCacheConfig *config = [[AVPCacheConfig alloc] init]; 380 | //开启缓存功能 381 | config.enable = YES; 382 | //能够缓存的单个文件最大时长。超过此长度则不缓存 383 | config.maxDuration = 100; 384 | //缓存目录的位置,需替换成app期望的路径 385 | config.path = @"please use your cache path here"; 386 | //缓存目录的最大大小。超过此大小,将会删除最旧的缓存文件 387 | config.maxSizeMB = 200; 388 | //设置缓存配置给到播放器 389 | [self.player setCacheConfig:config]; 390 | ``` 391 | 392 | 缓存成功之后,以下情况将会利用缓存文件(必须已经设置了`setCacheConfig`) 393 | 394 | 1. 如果设置了循环播放,那么第二次播放的时候,将会自动播放缓存的文件。 395 | 1. 缓存成功后,重新创建播放器,播放同样的资源,也会自动使用缓存文件。 396 | 397 | > 注意:vid的缓存文件是通过vid等信息定位的,所以,对于VID的缓存文件,将需要网络请求信息之后才能确定使用哪个缓存文件。 398 | 399 | 400 | 同时,播放器提供了获取缓存文件路径的接口: 401 | 402 | ```objectivec 403 | -(NSString *) getCacheFilePath:(NSString *)URL; 404 | 功能:根据url获取缓存的文件名。必须先调用setCacheConfig才能获取到。 405 | 参数:URL URL 406 | 返回值:最终缓存的文件绝对路径。 407 | 408 | -(NSString *) getCacheFilePath:(NSString *)vid format:(NSString *)format definition:(NSString *)definition; 409 | 功能:根据vid 获取缓存的文件名。必须先调用setCacheConfig才能获取到。 410 | 参数:vid 视频id。format 视频格式。definition 视频清晰度。previewTime 试看时长。 411 | 返回值:最终缓存的文件绝对路径。 412 | ``` 413 | 414 | 边播边缓存也不是所有的视频都会缓存,**有些情况是不会缓存的**。这里详细介绍一下:
1.对于直接播放URL的方式,即`AVPUrlSource`。如果是HLS(即m3u8)地址,将**不会**缓存。如果是其他支持的格式,则根据缓存配置进行缓存。
2.对于VID的方式播放,将会根据缓存配置进行缓存。
3.播放器读取完全部的数据则视为缓存成功。如果在此之前,调用`stop`,或者出错`onError`,则缓存将会失败。
4.cache内的seek的操作不会影响缓存结果。cache外的seek会导致缓存失败。
5.如果加密文件与app信息不一致,将会缓存失败。
6.cache的结果回调,会通过`onPlayerEventInfo`回调。 415 | 416 | ```objectivec 417 | -(void)onPlayerEvent:(AliPlayer*)player eventWithString:(AVPEventWithString)eventWithString description:(NSString *)description { 418 | if (eventWithString == EVENT_PLAYER_CACHE_SUCCESS) { 419 | //缓存成功事件。 420 | }else if (eventWithString == EVENT_PLAYER_CACHE_ERROR) { 421 | //缓存失败事件。 422 | } 423 | } 424 | ``` 425 | 426 | []() 427 | 428 | ### 14. 试看功能 429 | 430 | 试看功能是指:当设置试看的时长,通过播放器SDK播放视频时,服务端将不会返回完整的视频内容,而是返回试看时间段的内容。
播放器SDK 通过配合点播服务配置,可以实现试看功能,支持VidSts和VidAuth两种方式。如何配置和使用试看功能参考 [点播试看最佳实践](https://help.aliyun.com/document_detail/120987.html) 。配置试看功能之后,通过SDK 的VidPlayerConfigGen的`setPreviewTime`方法设置播放器的试看时长。以AVPVidStsSource为例: 431 | 432 | ```objectivec 433 | AVPVidStsSource *source = [[AVPVidStsSource alloc] init]; 434 | .... 435 | VidPlayerConfigGenerator* vp = [[VidPlayerConfigGenerator alloc] init]; 436 | [vp setPreviewTime:20];//20秒试看 437 | source.playConfig = [vp generatePlayerConfig];//设置给播放源 438 | ... 439 | ``` 440 | 441 | `VidPlayerConfigGen`支持设置服务端支持的请求参数。点击查看 [请求参数说明](https://help.aliyun.com/document_detail/86952.html#PlayConfig)。 442 | 443 | []() 444 | 445 | ### 15. 硬解开关 446 | 447 | 播放器SDK 提供了264,265的硬解码能力,同时提供了`enableHardwareDecoder`提供开关。默认开,并且在硬解初始化失败时,自动切换为软解,保证视频的正常播放。 448 | 449 | ```objectivec 450 | //开启硬解。默认开启 451 | self.player.enableHardwareDecoder = YES; 452 | ``` 453 | 454 | 如果从硬解自动切换为软解,将会通过`onPlayerEvent`回调: 455 | 456 | ```objectivec 457 | -(void)onPlayerEvent:(AliPlayer*)player eventWithString:(AVPEventWithString)eventWithString description:(NSString *)description { 458 | if (eventWithString == EVENT_SWITCH_TO_SOFTWARE_DECODER) { 459 | //切换到软解 460 | } 461 | } 462 | ``` 463 | 464 | []() 465 | 466 | ### 16. 设置Referer 467 | 468 | 播放器SDK提供了`AVPConfig` 用来设置请求referer。配合控制台的黑白名单referer,可以控制访问权限。播放器SDK的设置如下: 469 | 470 | ```objectivec 471 | //先获取配置 472 | AVPConfig *config = [self.player getConfig]; 473 | //设置referer 474 | config.referer = referer; 475 | ....//其他设置 476 | //设置配置给播放器 477 | [self.player setConfig:config]; 478 | ``` 479 | 480 | 481 | 482 | ### 17. 设置UserAgent 483 | 484 | 播放器SDK提供了`AVPConfig` 用来设置请求UA。设置之后,播放器请求的过程中将会带上UA信息。播放器SDK的设置如下: 485 | 486 | ```objectivec 487 | //先获取配置 488 | AVPConfig *config = [self.player getConfig]; 489 | //设置userAgent 490 | config.userAgent = userAgent; 491 | ....//其他设置 492 | //设置配置给播放器 493 | [self.player setConfig:config]; 494 | ``` 495 | 496 | 497 | 498 | ### 18. 配置网络重试时间和次数 499 | 500 | 通过`AVPConfig`,用户可以设置播放器SDK的网络超时的时间和重试次数。播放器SDK的设置如下: 501 | 502 | ```objectivec 503 | //先获取配置 504 | AVPConfig *config = [self.player getConfig]; 505 | //设置网络超时时间,单位ms 506 | config.networkTimeout = 5000; 507 | //设置超时重试次数。每次重试间隔为networkTimeout。networkRetryCount=0则表示不重试,重试策略app决定,默认值为2 508 | config.networkRetryCount = 2; 509 | ....//其他设置 510 | //设置配置给播放器 511 | [self.player setConfig:config]; 512 | ``` 513 | 514 | 1. 如果设置了networkRetryCount:如此时发生网络问题,导致出现loading后,那么将会重试networkRetryCount次,每次的间隔时间为networkTimeout。 如果重试多次之后,还是loading的状态,那么就会回调`onError`事件,此时,AVPErrorModel.code为ERROR_LOADING_TIMEOUT。 515 | 1. 如果networkRetryCount设置为0,当网络重试超时的时候,播放器就会回调onPlayerEvent,参数eventWithString为EVENT_PLAYER_NETWORK_RETRY。 此时,可以调用播放器的`reload`方法进行重新加载网络,或者进行其他的处理。 516 | 517 | []() 518 | 519 | ### 19. 配置缓存和延迟控制 520 | 521 | 对于播放器来说,缓存的控制非常重要。合理的配置,可以有效的加快起播速度,减少卡顿。播放器SDK通过`AVPConfig`提供了设置缓存和延迟的控制接口。 522 | 523 | ```objectivec 524 | //先获取配置 525 | AVPConfig *config = [self.player getConfig]; 526 | //最大延迟。注意:直播有效。当延时比较大时,播放器sdk内部会追帧等,保证播放器的延时在这个范围内。 527 | config.maxDelayTime = 5000; 528 | // 最大缓冲区时长。单位ms。播放器每次最多加载这么长时间的缓冲数据。 529 | config.maxBufferDuration = 50000; 530 | //高缓冲时长。单位ms。当网络不好导致加载数据时,如果加载的缓冲时长到达这个值,结束加载状态。 531 | config.highBufferDuration = 3000; 532 | // 起播缓冲区时长。单位ms。这个时间设置越短,起播越快。也可能会导致播放之后很快就会进入加载状态。 533 | config.startBufferDuration = 500; 534 | //其他设置 535 | //设置配置给播放器 536 | [self.player setConfig:config]; 537 | ``` 538 | 539 | > 注意:三个缓冲区时长的大小关系必须为:startBufferDuration<=highBufferDuration<=maxBufferDuration。 540 | 541 | 542 | 543 | ### 20. 支持HTTP Header设置 544 | 545 | 播放器通过AVPConfig参数,可以给播放器中的请求加上http的header参数。代码如下: 546 | 547 | ```objectivec 548 | //先获取配置 549 | AVPConfig *config = [self.player getConfig]; 550 | //定义header 551 | NSMutableArray *httpHeaders = [[NSMutableArray alloc] init]; 552 | //比如使用httpdns时,需要设置Host。 553 | [httpHeaders addObject:@"Host:xxx.com"]; 554 | //设置header 555 | config.httpHeaders = httpHeaders; 556 | ....//其他设置 557 | //设置配置给播放器 558 | [self.player setConfig:config]; 559 | ``` 560 | 561 | 562 | 563 | ## 二. 列表播放功能 564 | 565 | 当前短视频列表播放比较流行。阿里播放器提供了完整的列表播放功能,内部包含预加载机制,大幅提高了视频的起播速度。列表播放的基本流程如下: 566 | 567 | 创建播放器->设置事件监听->添加多个播放源->播放某个播放源->播放控制->移动播放某个源->释放播放器。 568 | 569 | > 播放的功能与接口与上节播放功能一致。多了一些列表控制功能。播放器的创建,监听,控制,释放等功能,参考上一节内容 570 | 571 | 572 | 573 | ### 1.创建播放器 574 | 575 | `AliListPlayer`比`AliPlayer`多了列表播放的功能,其余功能是一致的。列表播放就使用`AliListPlayer`。创建方法如下: 576 | 577 | ```objectivec 578 | self.listPlayer = [[AliListPlayer alloc] init]; 579 | ``` 580 | 581 | 582 | ### 2. 设置预加载个数 583 | 584 | 合理设置预加载个数,能够有效的提高起播的速度。 585 | 586 | ```objectivec 587 | //设置预加载个数。总共加载的个数为: 1 + count*2。 588 | self.listplyer.preloadCount = 2; 589 | ``` 590 | 591 | 592 | ### 3. 添加/移除 多个播放源 593 | 594 | 列表播放支持两种播放源:AVPVidStsSource和AVPUrlSource。url为直接的url地址,vid为点播视频id。 595 | 596 | > 不支持VidAuth和VidMps的方式。 597 | 598 | 599 | ```objectivec 600 | //添加vid源 601 | [self.listPlayer addVidSource:videoId uid:UUIDString]; 602 | //添加URL源 603 | [self.listPlayer addUrlSource:URL uid:UUIDString]; 604 | //移除某个源 605 | [self.listPlayer removeSource:UUIDString]; 606 | ``` 607 | 608 | > uid是视频的唯一标志。用于区分视频是否一样。如果uid一样,则认为是一样的。 609 | > 如果播放出现串流的情况,请注意查看是不是在不同的界面设置了同一个uid。 610 | 611 | 612 | 613 | ### 4. 播放某个源 614 | 615 | 添加了一个或多个播放源之后,便可以播放某个源。接口如下: 616 | 617 | ```objectivec 618 | //url时使用此接口 619 | - (BOOL) moveTo:(NSString*)uid; 620 | //vid的时候使用此接口,需要传递stsInfo,保证不会失效 621 | - (BOOL) moveTo:(NSString*)uid accId:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region; 622 | ``` 623 | 624 | 625 | ### 4. 播放上一个、下一个视频 626 | 627 | 播放器提供了moveToPrev,moveToNext接口用于播放上一个,下一个视频 628 | 629 | ``` 630 | //移动到下一个视频。 注意:只能用于url的源。这个方法不适用于vid的播放。 631 | - (BOOL) moveToNext; 632 | //移动到上一个视频。注意:只能用于url的源。这个方法不适用于vid的播放。 633 | - (BOOL) moveToPre; 634 | //移动到下一个视频。注意:只能用于vid的播放。 635 | - (BOOL) moveToNext:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region; 636 | // 移动到上一个视频。注意:只能用于vid的播放。 637 | - (BOOL) moveToPre:(NSString*)accId accKey:(NSString*)accKey token:(NSString*)token region:(NSString*)region; 638 | ``` 639 | 640 | 641 | 642 | ## 三. 视频下载功能 643 | 644 | 阿里云SDK提供了点播服务视频的下载功能,能够通过VidSts和VidAuth下载点播服务上的视频。同时,下载的方式提供了`安全下载`和`普通下载`的模式(在控制台设置)。
`普通下载`含义是:即使点播服务已经加密过了,下载后的视频数据也不是经过阿里云加密的。也就是说,**用户可以用第三方播放器播放。**
`安全下载`含义是:即使点播服务没有加密视频,下载后的视频数据也是经过阿里云加密的。也就是说,**用户用第三方播放器是播放不了的。只能使用阿里云的播放器去播放** 645 | 646 | 视频下载的基本流程如下: 647 | 648 | 创建并设置下载器->设置事件监听->准备下载源->准备成功后选择下载项->更新下载源并开始下载->下载成功/失败后,释放下载器。 649 | 650 | []() 651 | 652 | ### 1. 创建并设置下载器 653 | 654 | 创建下载器。代码如下: 655 | 656 | ```objectivec 657 | AliMediaDownloader *downloader = [[AliMediaDownloader alloc] init]; 658 | [downloader setSaveDirectory:self.downLoadPath]; 659 | [downloader setDelegate:self]; 660 | ``` 661 | 662 | 下载SDK支持私有加密的下载。为了保证安全性,需要配置一个加密校验文件到播放器。(建议在Application中配置一次即可) 663 | 664 | ```objectivec 665 | NSString *encrptyFilePath = [[NSBundle mainBundle] pathForResource:@"encryptedApp" ofType:@"dat"]; 666 | [AliPrivateService initKey:encrptyFilePath]; 667 | ``` 668 | 669 | 下载时如果是安全下载,那么不一致的话,会导致下载失败。 670 | 671 | []() 672 | 673 | ### 2. 设置监听事件 674 | 675 | 下载器提供了多个事件监听。设置代码如下: 676 | 677 | ```objectivec 678 | -(void)onPrepared:(AliMediaDownloader *)downloader mediaInfo:(AVPMediaInfo *)info { 679 | //准备下载项成功 680 | } 681 | 682 | -(void)onError:(AliMediaDownloader *)downloader errorModel:(AVPErrorModel *)errorModel { 683 | //下载出错 684 | } 685 | 686 | -(void)onDownloadingProgress:(AliMediaDownloader *)downloader percentage:(int)percent { 687 | //下载进度百分比 688 | } 689 | 690 | -(void)onProcessingProgress:(AliMediaDownloader *)downloader percentage:(int)percent { 691 | //处理进度百分比 692 | } 693 | 694 | -(void)onCompletion:(AliMediaDownloader *)downloader { 695 | //下载成功 696 | } 697 | 698 | ``` 699 | 700 | []() 701 | 702 | ### 3.准备下载源 703 | 704 | 通过`preapre`方法准备下载源。下载源支持AVPVidStsSource和AVPVidAuthSource两种。以AVPVidStsSource举例: 705 | 706 | ```objectivec 707 | //创建VidSts 708 | AVPVidStsSource* stsSource = [[AVPVidStsSource alloc] init]; 709 | stsSource.vid = source.vid;//视频vid 710 | stsSource.region = DEFAULT_SERVER.region;//接入区域 711 | stsSource.securityToken = DEFAULT_SERVER.securityToken;//安全token 712 | stsSource.accessKeySecret = DEFAULT_SERVER.accessKeySecret;//临时akSecret 713 | stsSource.accessKeyId = DEFAULT_SERVER.accessKeyId;//临时akId 714 | //准备下载源 715 | [downloader prepareWithVid:stsSource]; 716 | ``` 717 | 718 | []() 719 | 720 | ### 4.准备成功后选择下载项 721 | 722 | 准备成功后,会回调`onPrepared`方法。选择某个Track进行下载: 723 | 724 | ```objectivec 725 | -(void)onPrepared:(AliMediaDownloader *)downloader mediaInfo:(AVPMediaInfo *)info { 726 | NSArray* tracks = info.tracks; 727 | //比如:下载第一个TrackInfo 728 | [downloader selectTrack:[tracks objectAtIndex:0].trackIndex]; 729 | } 730 | ``` 731 | 732 | []() 733 | 734 | ### 5.更新下载源并开始下载 735 | 736 | 经过第4步之后,就可以开始下载了(为了防止VidSts和VidAuth过期,最好更新一下下载源的信息): 737 | 738 | ```objectivec 739 | //更新下载源 740 | [downloader updateWithVid:vidSource] 741 | //开始下载 742 | [downloader start]; 743 | ``` 744 | 745 | []() 746 | 747 | ### 6.下载成功/失败后,释放下载器 748 | 749 | 下载成功后,调用`destroy`释放下载器。 750 | 751 | ```objectivec 752 | [self.downloader destroy]; 753 | self.downloader = nil; 754 | ``` 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | -------------------------------------------------------------------------------- /aem_filter.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/aem_filter.framework/Info.plist -------------------------------------------------------------------------------- /aem_filter.framework/aem_filter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/aem_filter.framework/aem_filter -------------------------------------------------------------------------------- /alivcffmpeg.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/alivcffmpeg.framework/Info.plist -------------------------------------------------------------------------------- /alivcffmpeg.framework/alivcffmpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/alivcffmpeg.framework/alivcffmpeg -------------------------------------------------------------------------------- /artcSource.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/artcSource.framework/Info.plist -------------------------------------------------------------------------------- /artcSource.framework/artcSource: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/artcSource.framework/artcSource -------------------------------------------------------------------------------- /deletePod.sh: -------------------------------------------------------------------------------- 1 | export targetVersion=$1 2 | 3 | 4 | if [ ! "${targetVersion}" ] 5 | then 6 | echo "缺少要删除的pod版本号" 7 | exit 8 | fi 9 | 10 | pod trunk delete AliPlayerPartSDK_iOS ${targetVersion} 11 | pod trunk delete AliPlayerSDK_iOS ${targetVersion} 12 | pod trunk delete AliPlayerSDK_iOS_ARTC ${targetVersion} 13 | pod trunk delete AliPlayerSDK_iOS_MPF_FILTER ${targetVersion} 14 | pod trunk delete AliPlayerSDK_iOS_VFI_FILTER ${targetVersion} 15 | pod trunk delete AliPlayerSDK_iOS_AEM_FILTER ${targetVersion} -------------------------------------------------------------------------------- /mpf_filter.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/mpf_filter.framework/Info.plist -------------------------------------------------------------------------------- /mpf_filter.framework/mpf_filter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/mpf_filter.framework/mpf_filter -------------------------------------------------------------------------------- /publish_artc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | 4 | import os,sys 5 | 6 | spec = 'AliPlayerSDK_iOS_ARTC.podspec' 7 | 8 | if len(sys.argv) == 0: 9 | print('please input version') 10 | else: 11 | version = sys.argv[1] 12 | with open(spec) as f: 13 | lines = f.readlines() 14 | for i in range(len(lines)): 15 | if lines[i].find('s.version =') != -1: 16 | lines[i] = " s.version = \"" + version + "\"" + "\n" 17 | f.close 18 | 19 | 20 | with open(spec,'w+') as wf: 21 | wf.writelines(lines) 22 | wf.close 23 | 24 | tag = "git tag -a "+version+" -m '"+version+"'" 25 | trunk = 'pod trunk push ' + spec + ' --allow-warnings --verbose --skip-import-validation' 26 | 27 | os.system('git add .') 28 | os.system('git commit -m release') 29 | os.system('git push') 30 | os.system(tag) 31 | os.system('git push --tags') 32 | os.system(trunk) 33 | -------------------------------------------------------------------------------- /pushPod.sh: -------------------------------------------------------------------------------- 1 | 2 | pod spec lint AliPlayerPartSDK_iOS.podspec --verbose 3 | pod trunk push AliPlayerPartSDK_iOS.podspec 4 | 5 | pod spec lint AliPlayerSDK_iOS_ARTC.podspec --verbose 6 | pod trunk push AliPlayerSDK_iOS_ARTC.podspec 7 | 8 | # pod spec lint AliPlayerSDK_iOS_ARTP.podspec --verbose 9 | # pod trunk push AliPlayerSDK_iOS_ARTP.podspec 10 | 11 | pod spec lint AliPlayerSDK_iOS.podspec --verbose 12 | pod trunk push AliPlayerSDK_iOS.podspec 13 | 14 | pod spec lint AliPlayerSDK_iOS_MPF_FILTER.podspec --verbose 15 | pod trunk push AliPlayerSDK_iOS_MPF_FILTER.podspec 16 | 17 | pod spec lint AliPlayerSDK_iOS_VFI_FILTER.podspec --verbose 18 | pod trunk push AliPlayerSDK_iOS_VFI_FILTER.podspec 19 | 20 | pod spec lint AliPlayerSDK_iOS_AEM_FILTER.podspec --verbose 21 | pod trunk push AliPlayerSDK_iOS_AEM_FILTER.podspec -------------------------------------------------------------------------------- /pushPod_4.7.x.sh: -------------------------------------------------------------------------------- 1 | 2 | pod spec lint AliPlayerPartSDK_iOS.podspec --verbose 3 | pod trunk push AliPlayerPartSDK_iOS.podspec 4 | 5 | pod spec lint AliPlayerSDK_iOS_RTS.podspec --verbose 6 | pod trunk push AliPlayerSDK_iOS_RTS.podspec 7 | 8 | pod spec lint AliPlayerPartSDK_iOS_RTS.podspec --verbose 9 | pod trunk push AliPlayerPartSDK_iOS_RTS.podspec 10 | 11 | pod spec lint AliPlayerSDK_iOS.podspec --verbose 12 | pod trunk push AliPlayerSDK_iOS.podspec 13 | -------------------------------------------------------------------------------- /updateVersion.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | newPackageDir=$1 4 | 5 | CURRENT_DIR=$(cd $(dirname $0); pwd) 6 | echo ${CURRENT_DIR} 7 | 8 | rm -rf alivcffmpeg.framework/ 9 | rm -rf AliyunMediaDownloader.framework/ 10 | rm -rf AliyunPlayer.framework/ 11 | rm -rf artcSource.framework/ 12 | rm -rf mpf_filter.framework/ 13 | rm -rf vfi_filter.framework/ 14 | rm -rf aem_filter.framework/ 15 | 16 | echo "delete complete" 17 | 18 | cp -r ${newPackageDir}/SDK/ARM_SIMULATOR/alivcffmpeg.framework/ ${CURRENT_DIR}/ 19 | cp -r ${newPackageDir}/SDK/ARM_SIMULATOR/AliyunMediaDownloader.framework/ ${CURRENT_DIR}/ 20 | cp -r ${newPackageDir}/SDK/ARM_SIMULATOR/AliyunPlayer.framework/ ${CURRENT_DIR}/ 21 | cp -r ${newPackageDir}/SDK/ARM_SIMULATOR/artcSource.framework/ ${CURRENT_DIR}/ 22 | cp -r ${newPackageDir}/SDK/ARM_SIMULATOR/mpf_filter.framework/ ${CURRENT_DIR}/ 23 | cp -r ${newPackageDir}/SDK/ARM_SIMULATOR/vfi_filter.framework/ ${CURRENT_DIR}/ 24 | cp -r ${newPackageDir}/SDK/ARM_SIMULATOR/aem_filter.framework/ ${CURRENT_DIR}/ 25 | 26 | -------------------------------------------------------------------------------- /vfi_filter.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/vfi_filter.framework/Info.plist -------------------------------------------------------------------------------- /vfi_filter.framework/vfi_filter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliyunvideo/AliPlayerSDK/0e4eb0f374242ac0dd5b37ac1ec7f2d5d06756b1/vfi_filter.framework/vfi_filter --------------------------------------------------------------------------------