Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
bdb547f0
Commit
bdb547f0
authored
Apr 14, 2024
by
love_飞影
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: 调整未启播逻辑
parent
37d1ec28
Pipeline
#26470
passed with stages
in 7 minutes and 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
src/infra/audio/core/context.ts
src/infra/audio/core/context.ts
+6
-4
No files found.
src/infra/audio/core/context.ts
View file @
bdb547f0
...
@@ -32,13 +32,15 @@ export class NeosAudioContext extends EventEmitter<AudioScheduledSourceNodeEvent
...
@@ -32,13 +32,15 @@ export class NeosAudioContext extends EventEmitter<AudioScheduledSourceNodeEvent
};
};
document
.
addEventListener
(
"
click
"
,
autoPlay
);
document
.
addEventListener
(
"
click
"
,
autoPlay
);
}
}
//
如果超过音频长度还未播放,说明播放失败了,重新
播放
//
50ms 未启播,说明播放失败了,重新尝试
播放
const
timeout
=
setTimeout
(
async
()
=>
{
const
timeout
=
setTimeout
(
async
()
=>
{
if
(
source
.
loop
)
return
;
if
(
source
.
loop
)
return
;
if
(
this
.
state
===
"
closed
"
)
return
;
if
(
this
.
state
===
"
closed
"
)
return
;
await
this
.
suspend
();
if
(
source
.
context
.
currentTime
===
0
)
{
await
this
.
resume
();
await
this
.
suspend
();
},
buffer
.
duration
*
1000
);
await
this
.
resume
();
}
},
50
);
// 播放结束后关闭音频
// 播放结束后关闭音频
const
Ended
=
()
=>
{
const
Ended
=
()
=>
{
source
.
removeEventListener
(
"
ended
"
,
Ended
);
source
.
removeEventListener
(
"
ended
"
,
Ended
);
...
...
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