HarmonyOS 鸿蒙Next AVPlayer加载线上视频,无法添加header
HarmonyOS 鸿蒙Next AVPlayer加载线上视频,无法添加header
// 创建avPlayer实例对象
this.avPlayer = await media.createAVPlayer();
this.setAVPlayerCallback(this.avPlayer)
let mediaSource: media.MediaSource =
media.createMediaSourceWithUrl(this.mediaUrl, {“Token”: “abbbcvcc”});
// 设置媒体来源和播放策略
// this.avPlayer.url = this.mediaUrl
let playbackStrategy: media.PlaybackStrategy = {
preferredBufferDuration: 10,
preferredHdr: false
};
// 设置媒体来源和播放策略
this.avPlayer.setMediaSource(mediaSource, playbackStrategy);
<button style="position: absolute; padding: 4px 8px 0px; cursor: pointer; top: 8px; right: 8px; font-size: 14px;">复制</button>
这种方式加载视频时,没有对应的headers-Token
Host | — |
Range | bytes=35-36 |
User-Agent | OpenHarmony OS UA |
Accept | / |
Connection | Keep-alive |
Keep-Alive | timeout=120 |
关于HarmonyOS 鸿蒙Next AVPlayer加载线上视频,无法添加header的问题,您也可以访问:https://www.itying.com/category-93-b0.html 联系官网客服。