Reputation: 31
Just started learning Python. I met a strange behaviour of Audio in if
statement. It should work, but is not working.
See example here: https://colab.research.google.com/drive/1Jz6znaj047zrtDK-orp8VN0869xDYnQO?usp=sharing
This code works fine (plays wav file):
from IPython.display import Audio
sound_hey = "http://thecyberbuddy.com/sounds/hooray.wav"
Audio(sound_hey, autoplay=True) # plays ok
And this not:
from IPython.display import Audio
sound_boo = "http://mrclan.com/fastdl/tfc/sound/boo.wav"
s = 1
if s == 1:
Audio(sound_boo, autoplay=True) # dose not play...
Upvotes: 3
Views: 4581
Reputation: 375
Here
from IPython.display import Audio, display
sound_boo = "http://mrclan.com/fastdl/tfc/sound/boo.wav"
s = 1
if s == 1:
display(Audio(sound_boo, autoplay=True))
Upvotes: 6