Skip to content

Commit ef84b07

Browse files
committed
[OSX] Play sounds without making temporary files
1 parent 88072bb commit ef84b07

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

ldoce5viewer/qtgui/utils/soundplayer.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,7 @@ def play(self, data):
160160
if self._sound:
161161
self._sound.stop()
162162

163-
with NamedTemporaryFile(mode='w+b', prefix='',
164-
suffix='.tmp.mp3', delete=False) as f:
165-
f.write(data)
166-
167-
self._sound = AppKit.NSSound.alloc()
168-
self._sound.initWithContentsOfFile_byReference_(f.name, True)
163+
self._sound = AppKit.NSSound.alloc().initWithData_(data)
169164
self._sound.play()
170165

171166
def close(self):

0 commit comments

Comments
 (0)