Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
digitalPerson-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
digitalPerson
digitalPerson-fe
Commits
1c4664a8
Commit
1c4664a8
authored
Sep 30, 2024
by
nick zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 声音多个重叠播放
parent
24a93757
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
9 deletions
+25
-9
digital-audio-card.vue
...dialogue-detail/components/digital/digital-audio-card.vue
+7
-8
digital-audio.vue
...iews/dialogue-detail/components/digital/digital-audio.vue
+18
-1
No files found.
src/views/dialogue-detail/components/digital/digital-audio-card.vue
View file @
1c4664a8
<
script
setup
lang=
"ts"
>
import
{
computed
,
ref
}
from
'vue'
import
{
computed
}
from
'vue'
import
CustomIcon
from
'@/components/custom-icon/custom-icon.vue'
import
{
DigitalHumanDialogueTimbreItem
}
from
'../../dialogue-type'
import
{
useDigitalHumanDialogueStore
}
from
'@/store/modules/digital-human-dialogue'
...
...
@@ -12,6 +12,7 @@ interface Props {
interface
Emits
{
(
e
:
'click'
,
value
:
string
):
void
(
e
:
'toggle'
,
value
:
boolean
):
void
(
e
:
'play'
,
value
:
string
):
void
}
defineProps
<
Props
>
()
...
...
@@ -19,13 +20,8 @@ defineProps<Props>()
const
emit
=
defineEmits
<
Emits
>
()
const
digitalHumanDialogueStore
=
useDigitalHumanDialogueStore
()
const
digitalAudio
=
ref
<
HTMLAudioElement
>
()
const
timebreId
=
computed
(()
=>
digitalHumanDialogueStore
.
humanInfo
.
timebreId
)
function
playAudio
()
{
digitalAudio
.
value
?.
play
()
}
</
script
>
<
template
>
...
...
@@ -40,7 +36,11 @@ function playAudio() {
<div
class=
"flex-1 overflow-hidden"
>
<div
class=
"mb-2 flex items-center gap-2"
>
<div
class=
"max-w-32 truncate"
>
{{
dialogueTimbreItem
?.
name
}}
</div>
<CustomIcon
class=
"cursor-pointer text-lg"
icon=
"mingcute:volume-line"
@
click
.
stop
.
prevent=
"playAudio"
/>
<CustomIcon
class=
"cursor-pointer text-lg"
icon=
"mingcute:volume-line"
@
click
.
stop
.
prevent=
"emit('play', dialogueTimbreItem!.audioUrl)"
/>
</div>
<NScrollbar
x-scrollable
>
<div
class=
"flex gap-2"
>
...
...
@@ -52,5 +52,4 @@ function playAudio() {
<CustomIcon
class=
"cursor-pointer text-lg"
icon=
"ant-design:swap-outlined"
@
click=
"emit('toggle', true)"
/>
</div>
</div>
<audio
ref=
"digitalAudio"
:src=
"dialogueTimbreItem?.audioUrl"
></audio>
</
template
>
src/views/dialogue-detail/components/digital/digital-audio.vue
View file @
1c4664a8
...
...
@@ -27,6 +27,8 @@ const digitalTimbreMaleList = ref<DigitalHumanDialogueTimbreItem[]>([])
const
showAll
=
ref
(
false
)
const
searchName
=
ref
(
''
)
const
digitalAudioRef
=
ref
<
HTMLAudioElement
>
()
const
speed
=
computed
({
get
()
{
return
digitalHumanDialogueStore
.
humanInfo
.
speed
...
...
@@ -74,6 +76,7 @@ async function getDigitalTimbreList() {
function
handleUpdateAudioType
(
audioType
:
string
)
{
digitalHumanDialogueStore
.
humanInfo
.
timebreId
=
audioType
===
'mandarin'
?
'5132'
:
''
digitalAudioRef
.
value
?.
pause
()
}
async
function
handleSearch
(
value
:
string
)
{
...
...
@@ -88,6 +91,12 @@ async function handleSearch(value: string) {
function
handleClickAudioCard
(
timbreId
:
string
)
{
digitalHumanDialogueStore
.
setTimbreId
(
timbreId
)
}
function
handlePlayDigitalAudio
(
audioUrl
:
string
)
{
digitalAudioRef
.
value
?.
pause
()
digitalAudioRef
.
value
!
.
src
=
audioUrl
digitalAudioRef
.
value
?.
play
()
}
</
script
>
<
template
>
...
...
@@ -104,7 +113,12 @@ function handleClickAudioCard(timbreId: string) {
</div>
<div
v-show=
"isMandarinAudioType"
>
<DigitalAudioCard
:dialogue-timbre-item=
"digitalTimbreValue"
:show-toggle=
"true"
@
toggle=
"showAll = true"
/>
<DigitalAudioCard
:dialogue-timbre-item=
"digitalTimbreValue"
:show-toggle=
"true"
@
toggle=
"showAll = true"
@
play=
"handlePlayDigitalAudio"
/>
</div>
<div
class=
"mt-4 text-lg"
>
聲音
</div>
...
...
@@ -145,7 +159,10 @@ function handleClickAudioCard(timbreId: string) {
:key=
"index"
:dialogue-timbre-item=
"timbre"
@
click=
"handleClickAudioCard"
@
play=
"handlePlayDigitalAudio"
/>
</NScrollbar>
</div>
<audio
ref=
"digitalAudioRef"
/>
</template>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment