Skip to content

Commit d1bb1ae

Browse files
committed
Add new md
1 parent 0621a63 commit d1bb1ae

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

demo/mybuddy_demo/emoticon.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Instructions for playing animations on MyBuddy screen.
2+
[中文]
3+
1.[视频文件](emoticon.zip)[案例代码](./mybuddy_emoticon_demo.py)下载并且解压到mybuddy系统内
4+
5+
2. 更改案例`pymycobot/demo/mybuddy_demo/mybuddy_emoticon_demo.py`文件,
6+
7+
`/home/er/pymycobot/emo/face_video_3_2.mp4`替换成解压出来的视频文件路径
8+
```python
9+
from pymycobot import MyBuddyEmoticon
10+
import time
11+
12+
# [video_path, Playback_duration(s)]
13+
video1 = ["/home/er/pymycobot/emo/face_video_3_2.mp4", 10]
14+
15+
datas = [video1]
16+
17+
me = MyBuddyEmoticon(datas)
18+
...
19+
```
20+
3. 执行mybuddy_emoticon_demo.py即可
21+
[API说明文档](../../docs/mybuddy_emoticon.md)
22+
---
23+
[English]
24+
1. Download and unzip [video file](emoticon.zip) and [case code](./mybuddy_emoticon_demo.py) into the mybuddy system
25+
26+
2. Change the case `pymycobot/demo/mybuddy_demo/mybuddy_emoticon_demo.py` file,
27+
28+
Replace `/home/er/pymycobot/emo/face_video_3_2.mp4` with the decompressed video file path
29+
```python
30+
from pymycobot import MyBuddyEmoticon
31+
import time
32+
33+
# [video_path, Playback_duration(s)]
34+
video1 = ["/home/er/pymycobot/emo/face_video_3_2.mp4", 10]
35+
36+
datas = [video1]
37+
38+
me = MyBuddyEmoticon(datas)
39+
...
40+
```
41+
3. Execute mybuddy_emoticon_demo.py
42+
43+
[API document](../../docs/mybuddy_emoticon.md)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from pymycobot import MyBuddyEmoticon
2+
import time
3+
4+
# [video_path, Playback_duration(s)]
5+
video1 = ["/home/er/pymycobot/emo/face_video_3_2.mp4", 10]
6+
7+
datas = [video1]
8+
9+
me = MyBuddyEmoticon(datas)
10+
me.start()
11+
12+
time.sleep(3)
13+
# Pause playback
14+
me.pause()
15+
16+
time.sleep(3)
17+
# Continue playing
18+
me.run()
19+
20+
# Waiting for playback to complete
21+
me.join()

docs/mybuddy_emoticon.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# MyBuddyEmoticon
2+
3+
## MyBuddyEmoticon(file_path: list = [], window_size: tuple = (), loop=False)
4+
API for playing emoticons
5+
6+
* **Parameters**
7+
8+
**file_path(list)**: `[[path, time]]`The absolute path of facial expression video and the length of time to play.Time in seconds.
9+
**window_size(tuple)**: `(Length, width) `Size of the playback window (default is full screen).
10+
loop: Loop playback or not (only once by default).
11+
12+
### file_path()
13+
Get Playfile List
14+
* **Return**
15+
* video path list
16+
17+
### add_file_path(path_time)
18+
Add Playback File
19+
* **Parameters**
20+
**path_time(list)**: `[path, time]` The video address to be added and the running time
21+
22+
### del_file_path(index)
23+
Delete the element with the specified subscript in the playlist list
24+
* **Parameters**
25+
26+
**index(int)**:: The subscript of the element in the playlist to be deleted
27+
28+
### pause()
29+
Pause playback
30+
31+
### run()
32+
Continue playing
33+
34+
### start()
35+
start playing video
36+
37+
### join()
38+
Wait for the thread playing the video to finish.
39+
40+
[--->>> play_demo](../demo/mybuddy_demo/mybuddy_emoticon_demo.py)

0 commit comments

Comments
 (0)