playsound icon indicating copy to clipboard operation
playsound copied to clipboard

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

Open iwat opened this issue 3 years ago • 3 comments

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.

iwat avatar Jan 04 '22 23:01 iwat

did it for me. +1

0xasim avatar Apr 24 '22 13:04 0xasim

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

Lightwave234 avatar May 03 '23 15:05 Lightwave234

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

samedovzaur avatar May 19 '23 20:05 samedovzaur