fix: 【华为验收】使用音频场景streamusage错误:STREAM_USAGE_MUSIC(音乐),应改为STREAM_USAGE_MOVIE(电影或视频),可以降低功耗
Showing
1 changed file
with
6 additions
and
0 deletions
| @@ -6,6 +6,7 @@ import { TrackingPlay } from 'wdTracking/Index'; | @@ -6,6 +6,7 @@ import { TrackingPlay } from 'wdTracking/Index'; | ||
| 6 | import { ParamType } from 'wdTracking/Index'; | 6 | import { ParamType } from 'wdTracking/Index'; |
| 7 | import { DateTimeUtils, Logger } from 'wdKit/Index'; | 7 | import { DateTimeUtils, Logger } from 'wdKit/Index'; |
| 8 | import { BackgroundAudioController } from './BackgroundAudioController'; | 8 | import { BackgroundAudioController } from './BackgroundAudioController'; |
| 9 | +import { audio } from '@kit.AudioKit'; | ||
| 9 | 10 | ||
| 10 | interface obj { | 11 | interface obj { |
| 11 | loop: boolean | 12 | loop: boolean |
| @@ -99,6 +100,11 @@ export class WDPlayerController { | @@ -99,6 +100,11 @@ export class WDPlayerController { | ||
| 99 | if(this.onLoaded) { | 100 | if(this.onLoaded) { |
| 100 | this.onLoaded(1) | 101 | this.onLoaded(1) |
| 101 | } | 102 | } |
| 103 | + // 【华为验收】使用音频场景streamusage错误:STREAM_USAGE_MUSIC(音乐),应改为STREAM_USAGE_MOVIE(电影或视频),可以降低功耗 | ||
| 104 | + this.avPlayer.audioRendererInfo = { | ||
| 105 | + usage: audio.StreamUsage.STREAM_USAGE_MOVIE, | ||
| 106 | + rendererFlags: 0 | ||
| 107 | + } | ||
| 102 | 108 | ||
| 103 | this.avPlayer?.prepare(); | 109 | this.avPlayer?.prepare(); |
| 104 | break; | 110 | break; |
-
Please register or login to post a comment