回答編集履歴
1
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
`IPython.display.Audio`
|
1
|
+
`IPython.display.Audio` オブジェクト(中身は [HTML の audio タグ](https://www.w3schools.com/html/html5_audio.asp))を関数内で表示する場合、`IPython.display()` で明示的にレンダリングする必要がある様です。
|
2
2
|
|
3
3
|
```python
|
4
4
|
from IPython.display import display
|
@@ -6,3 +6,13 @@
|
|
6
6
|
display(Audio("test.mp3", autoplay=True))
|
7
7
|
print("test")
|
8
8
|
```
|
9
|
+
|
10
|
+
もしくは、`Audio` オブジェクトを `change1()` から返して、Jupyter Notebook の toplevel で評価(eval)します。
|
11
|
+
```python
|
12
|
+
def change1():
|
13
|
+
aud = Audio("test.mp3", autoplay=True)
|
14
|
+
print("test")
|
15
|
+
return aud
|
16
|
+
|
17
|
+
change1()
|
18
|
+
```
|