Description
- Video player (airplay) API
Interface version
Version number |
Writer |
Date |
Description |
1.0 |
Xie Yicheng |
November 23, 2020 |
initial release |
IP address
http:
Video storage path
/usr/videoplayback.mp4
API list
Name |
Description |
set_path |
set playback path |
set_volume |
set playback volume |
cutover_video |
cutover videos |
set_position |
set position of a video window |
set_size |
set size of a video window |
get_directory |
get MP4 files in the directory |
set_status |
set playback status |
get_videotime |
get total duration / current playback progress of a video |
set_seek |
set forward / backward progress / playback progress |
- Note: set the background color to 8080 (hexadecimal) when setting video playback.
1. set_path
Request parameter description
Parameter name |
Type |
Description |
path |
string |
file path information |
Call sample
- ubus command method:
ubus call airplayer set_path '{"path":"/usr/videoplayback.mp4"}'
- wapi command method:
wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_path", "param": {"path": "/usr/layout_test.mp3"}}'
Return sample
{
"path": "\/usr\/videoplayback.mp4"
}
Return parameter description
Parameter Name |
Type |
Description |
path |
string |
file path information |
Error code
2. set_volume
Request parameter description
Parameter Name |
Type |
Description |
volume |
uint32 |
volume range 0-90 |
Call sample
- ubus command method:
ubus call airplayer set_volume '{"volume":10}'
- wapi command method:
wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_volume", "param": {"volume": "10"}}'
Return sample
{
"volume": 10
}
Return parameter description
Parameter Name |
Type |
Description |
volume |
uint32 |
volume value |
Error code
3. cutover_video
Request parameter description
Parameter Name |
Type |
Description |
cutover |
string |
“up”: choose the previous song; “down”: choose the next song |
Call sample
- ubus command method:
ubus call airplayer cutover_video '{"cutover":"up"}'
ubus call airplayer cutover_video '{"cutover":"down"}'
- wapi command method:
wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "cutover_video", "param": {"cutover_video": "up"}}'
wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "cutover_video", "param": {"cutover_video": "down"}}'
Return sample
{
"cutover": "down",
"index": 1,
"video": "\/usr\/videoplayback.mp4"
}
Return parameter description
Parameter Name |
Type |
Description |
cutover |
string |
choose the previous or next song |
index |
uint32 |
the directory of the current video |
video |
string |
the path to the currently playing video |
Error code
4. set_position
Request parameter description
Parameter Name |
Type |
Description |
position_x |
uint32 |
the x coordinate of the player |
position_y |
uint32 |
the y coordinate of the player |
Call sample
- ubus command method:
ubus call airplayer set_position '{"position_x":0,"position_y":0}'
- wapi command method:
wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_position", "param": {"position_x":0,"position_y":0}}'
Return sample
{
"position_x": 0,
"position_y": 0
}
Return parameter description
Parameter Name |
Type |
Description |
position_x |
uint32 |
the x coordinate of the player position |
position_y |
uint32 |
the y coordinate of the player position |
Error code
5. set_size
Request parameter description
Parameter Name |
Type |
Description |
size_width |
uint32 |
the width of the player |
size_height |
uint32 |
the height of the player |
Call sample
- ubus command method:
ubus call airplayer set_size '{"size_width":600,"size_height":400}'
- wapi command method:
wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_size", "param": {"size_width":600,"size_height":400}}'
Return sample
{
"size_width": 600,
"size_height": 400
}
Return parameter description
Parameter Name |
Type |
Description |
size_width |
uint32 |
the width of the player |
size_height |
uint32 |
the height of the player |
Error code
6. set_status
Request parameter description
Parameter Name |
Type |
Description |
status |
uint32 |
set playback status |
Call sample
- ubus command method:
stop playback:ubus call airplayer set_status '{"status":"stop"}'
pause playback:ubus call airplayer set_status '{"status":"pause"}'
resume playback:ubus call airplayer set_status '{"status":"continue"}'
playback mode switching (single loop, list loop, no loop):ubus call airplayer set_status '{"status":"mode"}'
- wapi command method:
stop playback:wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_status", "param": {"status":"stop"}}'
pause playback:wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_status", "param": {"status":"pause"}}'
resume playback:wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_status", "param": {"status":"continue"}}'
playback mode switching (single loop, list loop, no loop):wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_status", "param": {"status":"mode"}}'
Return sample
{
"status": "stop"
}
Return parameter description
Parameter Name |
Type |
Description |
status |
string |
playback status / mode |
Error code
7. set_seek
Request parameter description
Parameter Name |
Type |
Description |
seek |
uint32 |
set the forward and backward time / playback progress |
seek_direction |
uint32 |
0: backward; 1: forward; 2: set playback progress directly |
Call sample
- ubus command method:
forward:ubus call airplayer set_seek '{"seek":10,"seek_direction":1}'
backward:ubus call airplayer set_seek '{"seek":10,"seek_direction":0}'
set playback progress directly:ubus call airplayer set_seek '{"seek":0,"seek_direction":2}'
- wapi command method:
forward:wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_seek", "param": {"seek":10,"seek_direction":1}}'
backward:wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_seek", "param": {"seek":10,"seek_direction":0}}'
set playback progress directly:wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "set_seek", "param": {"seek":0,"seek_direction":2}}'
Return sample
{
"seek": -10,
"direction": 0
}
Return parameter description
Parameter Name |
Type |
Description |
seek |
uint32 |
forward and backward time / playback progress |
direction |
uint32 |
0: backward; 1: forward; 2: set playback progress directly |
Error code
8. get_videotime
Request parameter description
Parameter Name |
Type |
Description |
videotime |
uint32 |
get video duration/current playback progress |
Call sample
- ubus command method:
get video duration:ubus call airplayer get_videotime '{"videotime":"duration"}'
get current playback progress:ubus call airplayer get_videotime '{"videotime":"current"}'
- wapi command method:
get video duration:wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "get_videotime", "param": {"videotime":"duration"}}'
get current playback progress:wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "get_videotime", "param": {"videotime":"current"}}'
Return sample
{
"videotime": "duration",
"duration time": 60.027000
}
Return parameter description
Parameter Name |
Type |
Description |
videotime |
uint32 |
get playback time type |
time |
uint32 |
progress |
Error code
9. get_directory
Request parameter description
Parameter Name |
Type |
Description |
directory |
string |
the directory to be queried |
Call sample
- ubus command method:
ubus call airplayer get_directory '{"directory":"/usr"}'
- wapi command method:
wapi 8ms '{"ver": "1.0", "module": "airplayer", "api": "get_directory", "param": {"directory":"/usr"}}'
Return sample
{
"directory": "\/usr",
"num": 2,
"list": {"videoplayback.mp4",
"201_7.mp4"
}
}
Return parameter description
Parameter Name |
Type |
Description |
directory |
string |
the directory of the current query |
num |
uint32 |
total number of files queried |
list |
string |
file names queried |
Error code
文档更新时间: 2021-06-02 15:12 作者:plj