Description

  • Video player (airplay) API

Interface version

Version number Writer Date Description
1.0 Xie Yicheng November 23, 2020 initial release

IP address

http://192.168.1.1

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

  1. ubus command method:
ubus call airplayer set_path '{"path":"/usr/videoplayback.mp4"}'
  1. 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

Error Code Description

2. set_volume

Request parameter description

Parameter Name Type Description
volume uint32 volume range 0-90

Call sample

  1. ubus command method:
ubus call airplayer set_volume '{"volume":10}'
  1. 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

Error Code Description

3. cutover_video

Request parameter description

Parameter Name Type Description
cutover string “up”: choose the previous song; “down”: choose the next song

Call sample

  1. ubus command method:
ubus call airplayer cutover_video '{"cutover":"up"}'
ubus call airplayer cutover_video '{"cutover":"down"}'
  1. 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

Error Code Description

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

  1. ubus command method:
ubus call airplayer set_position '{"position_x":0,"position_y":0}'
  1. 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

Error Code Description

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

  1. ubus command method:
ubus call airplayer set_size '{"size_width":600,"size_height":400}'
  1. 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

Error Code Description

6. set_status

Request parameter description

Parameter Name Type Description
status uint32 set playback status

Call sample

  1. 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"}'
  1. 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

Error Code Description

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

  1. 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}'
  1. 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

Error Code Description

8. get_videotime

Request parameter description

Parameter Name Type Description
videotime uint32 get video duration/current playback progress

Call sample

  1. ubus command method:
get video duration:ubus call airplayer get_videotime '{"videotime":"duration"}'
get current playback progress:ubus call airplayer get_videotime '{"videotime":"current"}'
  1. 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

Error Code Description

9. get_directory

Request parameter description

Parameter Name Type Description
directory string the directory to be queried

Call sample

  1. ubus command method:
ubus call airplayer get_directory '{"directory":"/usr"}'
  1. 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

Error Code Description
文档更新时间: 2021-06-02 15:12   作者:plj