Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yuzhilin
2024-03-29 16:00:15 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
8f7db674b3507ac03b8a3c35d030849d88786ccf
8f7db674
2 parents
d186a496
3389202c
Merge branch 'main' of
http://192.168.1.42/developOne/harmonyPool
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
14 deletions
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
sight_harmony/features/wdComponent/src/main/ets/dialog/PaperReaderDialog.ets
sight_harmony/features/wdComponent/src/main/resources/base/media/icon_audio_pause.png
sight_harmony/features/wdComponent/src/main/resources/base/media/icon_audio_playing.png
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
View file @
8f7db67
...
...
@@ -7,7 +7,8 @@ import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel
import { PaperTitleComponent } from './PaperTitleComponent';
import { SingleColumn999Component } from './SingleColumn999Component';
import { topicInfoView } from './topicInfoView';
import { PlayerConstants, WDPlayerController } from 'wdPlayer';
import { DateFormatUtil, PlayerConstants, WDPlayerController } from 'wdPlayer';
import { AudioDataList } from 'wdBean/src/main/ets/bean/morningevening/AudioDataList';
const TAG = 'MorningEveningPaperComponent';
...
...
@@ -39,13 +40,19 @@ export struct MorningEveningPaperComponent {
// } as MorningEveningPaperDTO
@Provide title: string = ''
@Provide subTitle: string = ''
@Provide audioTitle: string = ''
@Provide isAudioPlaying: boolean = false
@Provide status: number = PlayerConstants.STATUS_START;
@Provide currentTime: string = "00:00";
@Provide totalTime: string = "00:00";
@Provide progressVal: number = 0;
private audioDataList: AudioDataList[] = []
private playerController: WDPlayerController = new WDPlayerController();
simpleAudioDialog: CustomDialogController = new CustomDialogController({
builder: PaperReaderSimpleDialog({
cancel: this.onCancel,
confirm: this.onConfirm
confirm: this.onConfirm,
playerController: this.playerController
}),
autoCancel: false,
customStyle: true,
...
...
@@ -58,13 +65,30 @@ export struct MorningEveningPaperComponent {
Logger.info(TAG, "cj2024 onCancel = ")
}
/**
* 回调无用
**/
onConfirm() {
Logger.info(TAG, "cj2024 onConfirm = ")
// if (this.playerController != undefined) {
//
// }
this.status = PlayerConstants.STATUS_PAUSE;
this.playerController?.pause()
// this.status = PlayerConstants.STATUS_PAUSE;
// this.playerController?.pause()
}
// 续播判断
changeContinue() {
Logger.info(TAG, "cj2024 changeContinue = 1")
// if (this.nextContId) {
this.playerController.continue = () => {
Logger.info(TAG, "cj2024 changeContinue = 2")
this.playerController?.stop();
// this.playVM.playWithContentId(this.nextContId ?? '');
}
return;
// }
this.playerController.continue = undefined;
}
async aboutToAppear() {
...
...
@@ -91,11 +115,16 @@ export struct MorningEveningPaperComponent {
this.compListItem = compInfoBean?.compList[0]
if (compInfoBean?.compList[0].audioDataList) {
this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0].audioUrl
this.audioTitle = compInfoBean?.compList[0].audioDataList[0].title
}
}
Logger.info(TAG, "compInfoBean compStyle = " + compInfoBean.compList[0].compStyle)
this.playerController.onTimeUpdate = (position, duration) => {
this.currentTime = DateFormatUtil.secondToTime(position);
this.totalTime = DateFormatUtil.secondToTime(duration);
this.progressVal = Math.floor(position * 100 / duration);
}
} catch (exception) {
}
...
...
sight_harmony/features/wdComponent/src/main/ets/dialog/PaperReaderDialog.ets
View file @
8f7db67
/**
* 简易音频对话框
* */
import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index'
@CustomDialog
export struct PaperReaderSimpleDialog {
...
...
@@ -8,13 +9,16 @@ export struct PaperReaderSimpleDialog {
}
confirm: () => void = () => {
}
playerController: WDPlayerController = new WDPlayerController()
paperReaderDialog: CustomDialogController = new CustomDialogController({
builder: PaperReaderDialog({
onCancel: this.cancel,
onConfirm: this.confirm
onConfirm: this.confirm,
playerController: this.playerController
}),
autoCancel: false,
customStyle: true,
alignment: DialogAlignment.CenterStart,
offset: { dx: 12, dy: -150 }
})
...
...
@@ -44,7 +48,7 @@ export struct PaperReaderSimpleDialog {
if (this.controllerSimple != undefined) {
this.controllerSimple.open()
}
},
1
00000);
},
5
00000);
}
}
...
...
@@ -58,6 +62,12 @@ export struct PaperReaderSimpleDialog {
* */
@CustomDialog
export struct PaperReaderDialog {
@Consume audioTitle: string;
@Consume currentTime: string;
@Consume totalTime: string;
@Consume progressVal: number;
@State currentStatus: number = 0;
playerController: WDPlayerController = new WDPlayerController()
controllerDetail?: CustomDialogController
onCancel: () => void = () => {
}
...
...
@@ -72,7 +82,7 @@ export struct PaperReaderDialog {
step: 5,
loop: Number.POSITIVE_INFINITY,
fromStart: true,
src:
"Running Marquee starts rolling"
src:
this.audioTitle
})
.width("60%")
.height(20)
...
...
@@ -91,12 +101,12 @@ export struct PaperReaderDialog {
})
Row() {
Text(
"00:00"
)
Text(
this.currentTime
)
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_999999'))
.height("100%")
.alignSelf(ItemAlign.Start)
Text("/
00:00"
)
Text("/
" + this.totalTime
)
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_999999'))
.height("100%")
...
...
@@ -107,7 +117,7 @@ export struct PaperReaderDialog {
.height(16)
.margin({ top: 4, left: 10 })
Progress({ value:
50
, total: 100, type: ProgressType.Capsule })
Progress({ value:
this.progressVal
, total: 100, type: ProgressType.Capsule })
.color($r('app.color.color_ED2800'))
.backgroundColor($r('app.color.white'))
.width("100%")
...
...
@@ -119,14 +129,16 @@ export struct PaperReaderDialog {
.justifyContent(FlexAlign.Start)
Row() {
Image(
$r("app.media.icon_audio_pause
"))
Image(
this.currentStatus != PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause") : $r("app.media.icon_audio_playing
"))
.objectFit(ImageFit.Contain)
.width(24)
.height(24)
.margin({ right: 12 })
.onClick(() => {
if (this.controllerDetail) {
this.onConfirm()
if (this.playerController) {
// this.onConfirm()
this.playerController.switchPlayOrPause()
this.currentStatus = this.playerController.getStatus()
}
})
...
...
@@ -135,6 +147,9 @@ export struct PaperReaderDialog {
.width(24)
.height(24)
.onClick(() => {
if (this.playerController) {
this.playerController.stop()
}
if (this.controllerDetail) {
this.controllerDetail.close()
}
...
...
sight_harmony/features/wdComponent/src/main/resources/base/media/icon_audio_pause.png
View file @
8f7db67
214 Bytes
|
W:
|
H:
201 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
sight_harmony/features/wdComponent/src/main/resources/base/media/icon_audio_playing.png
View file @
8f7db67
264 Bytes
|
W:
|
H:
298 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
Please
register
or
login
to post a comment