HarmonyOS鸿蒙Next中AVCastPicker在AVMetadata中设置filter后播控中心和投播组件无法获取到音频信息和正常播放

HarmonyOS鸿蒙Next中AVCastPicker在AVMetadata中设置filter后播控中心和投播组件无法获取到音频信息和正常播放

async setSessionInfo() {
  let metadata: AVMetadata = {
    assetId: '0',
    title: this.nowPlayingSong!.title,
    mediaImage: this.getPixelMap(await getCover(this.baseURL, this.username, this.password, this.nowPlayingSong!.id, 512)),
    duration: this.nowPlayingSong!.duration * 1000,
    artist: this.nowPlayingSong!.artist,
    lyric: this.convertToLrc(this.nowPlayingLyrics),
    filter: avSession.ProtocolType.TYPE_CAST_PLUS_STREAM | avSession.ProtocolType.TYPE_DLNA,
  };
  this.session!.setAVMetadata(metadata).then(() => {
    console.info(`SetAVMetadata successfully`);
  }).catch((err: BusinessError) => {
    console.error(`Failed to set AVMetadata. Code: ${err.code}, message: ${err.message}`);
  });
}

只有把filter那行删掉才正常显示和播放,这是为什么呢?


更多关于HarmonyOS鸿蒙Next中AVCastPicker在AVMetadata中设置filter后播控中心和投播组件无法获取到音频信息和正常播放的实战教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于HarmonyOS鸿蒙Next中AVCastPicker在AVMetadata中设置filter后播控中心和投播组件无法获取到音频信息和正常播放的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


在HarmonyOS鸿蒙Next中,如果在AVMetadata中设置了filter,可能会导致播控中心和投播组件无法正确获取音频信息,从而影响正常播放。建议检查filter的设置,确保其不会过滤掉必要的音频元数据。可以尝试移除或调整filter,或者手动添加必要的元数据字段,以确保播控中心和投播组件能够正确识别和播放音频内容。

回到顶部