mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
audio: bug fix: test out of memory on browsers
This commit is contained in:
parent
6f74e03cb3
commit
bf3ded2a55
@ -17,6 +17,7 @@ package audio
|
|||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -63,8 +64,16 @@ func (p *dummyPlayer) Play() {
|
|||||||
p.playing = true
|
p.playing = true
|
||||||
p.m.Unlock()
|
p.m.Unlock()
|
||||||
go func() {
|
go func() {
|
||||||
if _, err := io.ReadAll(p.r); err != nil {
|
var buf [4096]byte
|
||||||
panic(err)
|
for {
|
||||||
|
_, err := p.r.Read(buf[:])
|
||||||
|
if err != nil {
|
||||||
|
if err != io.EOF {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
time.Sleep(time.Millisecond)
|
||||||
}
|
}
|
||||||
p.m.Lock()
|
p.m.Lock()
|
||||||
p.playing = false
|
p.playing = false
|
||||||
|
Loading…
Reference in New Issue
Block a user