ChangbaDevs / KTVHTTPCache

A powerful media cache framework.
MIT License
2.35k stars 435 forks source link

请问一下,能看看这个流为什么不能缓存吗 ,是请求头的问题吗 #116

Closed cgmsuccess closed 8 months ago

cgmsuccess commented 5 years ago

http://app.pd.nf.migu.cn/MIGUM2.0/v1.0/content/sub/listenSong.do?netType=00&userId=0&ua=Android_migu&version=5.1&copyrightId=0&resourceType=E&contentId=600908000007622647&toneFlag=SQ

这是一个音乐流。ijk 如果不加缓存是可以播放的,加了ktvcache 就不行了

libobjc commented 8 months ago

Content-Type 的问题,使用如下 API 做进一步处理

/**
 *  Set the acceptable content types.
 *  The following values are only supported by default:
 *      video/x, audio/x, application/mp4, application/octet-stream, binary/octet-stream
 *  If you want to allow other content types, set them here.
 *
 *  @param acceptableContentTypes : The content types can be allowed.
 */
+ (void)downloadSetAcceptableContentTypes:(NSArray<NSString *> *)acceptableContentTypes;

/**
 *  Get the current acceptable content types.
 */
+ (NSArray<NSString *> *)downloadAcceptableContentTypes;

/**
 *  Set the unacceptable content type disposer.
 *  If the receive response's Content-Type not included in acceptContentTypes, this method will be called.
 *  If the return value of block is YES, you can continue to load resources. Otherwise the HTTP task will be rejected.
 *
 *  @param unacceptableContentTypeDisposer : The unacceptable content type disposer.
 */
+ (void)downloadSetUnacceptableContentTypeDisposer:(BOOL(^)(NSURL *URL, NSString *contentType))unacceptableContentTypeDisposer;