diff --git a/entry/src/main/ets/component/ControlAreaComponent.ets b/entry/src/main/ets/component/ControlAreaComponent.ets index 2ac3f7f39599daab3eaba769cea92a8da2d61a70..30ce165cf0d3b913005a616d488ccab504a29e6b 100644 --- a/entry/src/main/ets/component/ControlAreaComponent.ets +++ b/entry/src/main/ets/component/ControlAreaComponent.ets @@ -180,6 +180,7 @@ export struct ControlAreaComponent { async audioCastControllerStateChange() { if (this.audioCastController) { this.currentTime = this.audioCastController.elapsedTime; + this.durationTime = this.songList[this.selectIndex].duration; this.volumeValue = this.audioCastController.volume; this.isPlay = this.audioCastController.state === avSession.PlaybackState.PLAYBACK_STATE_PLAY; if (this.audioCastController.state === avSession.PlaybackState.PLAYBACK_STATE_PREPARE) { diff --git a/entry/src/main/ets/model/SongData.ets b/entry/src/main/ets/model/SongData.ets index e1d1b2af83f1e8cc258efe09f95a8f7771b9e4ea..19b1c429d8ad0ab781f700d5ded075db5fd15d5b 100644 --- a/entry/src/main/ets/model/SongData.ets +++ b/entry/src/main/ets/model/SongData.ets @@ -45,6 +45,10 @@ export class SongItem { * albumCoverUri information. */ albumCoverUri: string = ''; + /** + * song duration. + */ + duration: number = 0; /** * Tone Quality list information. */ diff --git a/entry/src/main/ets/model/SongListData.ets b/entry/src/main/ets/model/SongListData.ets index 2a8dbee67776c52aa37079b8498d97a7926c3474..579c2b9a20c295191bd74b6211026ba955002d9b 100644 --- a/entry/src/main/ets/model/SongListData.ets +++ b/entry/src/main/ets/model/SongListData.ets @@ -24,6 +24,7 @@ const songList: SongItem[] = [ pcmSrc: 'Delacey - Dream It Possible.pcm', lyric: 'lrcfiles/DreamItPossible.lrc', albumCoverUri: 'https://www-file.huawei.com/admin/asset/v1/pro/view/23eb4b8c0571484fb9bce7889aed4413.jpg', + duration: 204000, toneQualityList: [ToneQuality.SQ, ToneQuality.SPATIAL_AUDIO, ToneQuality.MASTER] }, { @@ -34,6 +35,7 @@ const songList: SongItem[] = [ pcmSrc: 'boisterous.pcm', lyric: '', albumCoverUri: 'https://www-file.huawei.com/admin/asset/v1/pro/view/9240a42357da4644834897262b183b8d.jpg', + duration: 95291, toneQualityList: [ToneQuality.SQ, ToneQuality.SPATIAL_AUDIO, ToneQuality.MASTER] }, ]