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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
MyCard
Neos
Commits
15484bb6
Commit
15484bb6
authored
Apr 14, 2024
by
love_飞影
Committed by
Chunchi Che
May 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: 调整未启播逻辑
parent
7fcbe51f
Changes
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 @
15484bb6
...
...
@@ -32,13 +32,15 @@ export class NeosAudioContext extends EventEmitter<AudioScheduledSourceNodeEvent
};
document
.
addEventListener
(
"
click
"
,
autoPlay
);
}
//
如果超过音频长度还未播放,说明播放失败了,重新
播放
//
50ms 未启播,说明播放失败了,重新尝试
播放
const
timeout
=
setTimeout
(
async
()
=>
{
if
(
source
.
loop
)
return
;
if
(
this
.
state
===
"
closed
"
)
return
;
await
this
.
suspend
();
await
this
.
resume
();
},
buffer
.
duration
*
1000
);
if
(
source
.
context
.
currentTime
===
0
)
{
await
this
.
suspend
();
await
this
.
resume
();
}
},
50
);
// 播放结束后关闭音频
const
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