TaylorSMarks / playsound

Pure Python, cross platform, single function module with no dependencies for playing sounds.
Other
517 stars 114 forks source link

MacOS + URL got "Could not load sound with filename, although URL was good..." #107

Open iwat opened 2 years ago

iwat commented 2 years ago

I was trying to write a Dropbox music player and hit this error:

Could not load sound with filename, although URL was good... https://....

For an unknown reason, I updated playsound.py and it is now working:

-         nssound = NSSound.alloc().initWithContentsOfURL_byReference_(url, True)
+         nssound = NSSound.alloc().initWithContentsOfURL_byReference_(url, False)

This works for both local files and URLs. I'm not really sure what that byReference actually is.

https://developer.apple.com/documentation/appkit/nssound/1477288-initwithcontentsofurl?language=objc

When YES only the name of the sound is stored with the NSSound instance when archived using encodeWithCoder:; otherwise the audio data is archived along with the instance.

0xasim commented 2 years ago

did it for me. +1

Lightwave234 commented 1 year ago

worked for me too on macOS 13.0 on a M1 mac.

samedovzaur commented 1 year ago

it didn't work for me tho. it kept showing the same error