AirMedia API¶
This API allows you to multimedia stream to any airmedia device reachable by the Freebox, as well as configuring the airmedia server hosted on the Freebox Server.
AirMedia Errors¶
When attempting to access the file airmedia API, you may encounter the following errors:
error_code | Description |
---|---|
unknown_target | No airmedia device with this name in range |
no_client | No airmedia client connected |
set_pass | Unable to update password |
set_onscreen_code | Unable to activate onscreen code |
no_ctrl | Remote control is unavailable |
http | Internal HTTP error |
bad_session | No stream session found |
bad_name | Invalid airmedia name |
bad_device_id | No device with this id |
bad_remote_id | No remote control with this id |
req_in_progress | You should try again, another request is still processing |
fetch | Unable to get slideshow information |
no_display | No screen available |
playback_state | Invalid playback state |
no_slideshow_srv | Slideshow is not supported |
no_mem | Internal error |
inout_file | Unable to read input file |
no_volume_control | Volume control is not available |
connect | Error connecting to the airmedia device |
unauthorized | This device requests a password |
unsupported_media | The device does not support this format |
bad_type | Invalid file type |
unimplemented | Unimplemented |
AirMedia Config Object¶
AirMedia config has the following attributes:
AirMedia Configuration API¶
Get the current AirMedia configuration¶
-
GET
/api/v4/airmedia/config/
¶ Returns the current
AirMediaConfig
Example request:
GET /api/v4/airmedia/config/ HTTP/1.1 Host: mafreebox.freebox.fr
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ success: true, result: { enabled: true } }
Update the current AirMedia configuration¶
-
PUT
/api/v4/airmedia/config/
¶ Update the current
AirMediaConfig
Example request:
PUT /api/v4/airmedia/ HTTP/1.1 Host: mafreebox.freebox.fr { "enabled": true, "password": "3615" }
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ success: true, result: { enabled: true } }
AirMedia Receiver Object¶
AirMedia receivers have the following attributes
-
AirMediaReceiver
¶ -
name
string Read-only¶ AirMedia name
-
password_protected
bool Read-only¶ Is set to true the receiver is protected by a password
-
capabilities
map Read-only¶ List of receiver capabilities from the following list
Capability Description photo can display photos audio can play audio files video can play video files screen can display remote screen
-
Get the list of available AirMedia receivers¶
You can get the list of AirMediaReceiver
connected to
the Freebox Server using this API
-
GET
/api/v4/airmedia/receivers/
¶ Get the list of
AirMediaReceiver
connected to the Freebox ServerExample request:
GET /api/v4/airmedia/receivers/ HTTP/1.1 Host: mafreebox.freebox.fr
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ success: true, result: [ { capabilities: { photo: true, screen: false, audio: true, video: true }, name: "Freebox Player", password_protected: true }, { capabilities: { photo: false, screen: false, audio: true, video: false }, name: "Freebox Server", password_protected: false } ] }
Interacting with an AirMedia receiver¶
Once you have selected an available AirMediaReceiver
you can start interacting with it by sending media with the following
API.
AirMedia receiver request¶
-
AirMediaReceiverRequest
¶ -
action
enum¶ Action Description start start playing a media stop stop playing a media
-
media_type
string¶ Media Type Description photo display a photo video display a video
-
password
string¶ Optional receiver password.
-
position
int¶ Start position for a video.
The start position is expressed in percent * 1000, for instance 50000 means 50% of the video
-
media
string¶ The media to play.
- For video media, you have to specify the media URL, for instance http://anon.nasa-global.edgesuite.net/HD_downloads/GRAIL_launch_480.mov
- For photo media, you have to specify the file path on the Freebox Server (base64 encoded as returned in fs/ls call), for instance L0Rpc3F1ZSBkdXIvUGhvdG9zL1JvY2tldHMvRFNDXzM0OTEuanBn
-
Sending a new request to an AirMedia receiver¶
-
POST
/api/v4/airmedia/receviers/{receiver_name}/
¶ Example: display a photo on the Freebox Player:
POST /api/v4/airmedia/receivers/Freebox%20Player/ HTTP/1.1 Host: mafreebox.freebox.fr { "action": "start", "media_type": "photo", "media": "L0Rpc3F1ZSBkdXIvUGhvdG9zL1JvY2tldHMvRFNDXzM0OTEuanBn", "password": "1111" }
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, }
Example: play a video the Freebox Player:
POST /api/v4/airmedia/receivers/Freebox%20Player/ HTTP/1.1 Host: mafreebox.freebox.fr { "action": "start", "media_type": "video", "media": "http://anon.nasa-global.edgesuite.net/HD_downloads/GRAIL_launch_480.mov", "password": "1111" }
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, }
Example: stop the current AirMedia video on Freebox Player:
POST /api/v4/airmedia/receivers/Freebox%20Player/ HTTP/1.1 Host: mafreebox.freebox.fr { "action": "stop", "media_type": "video" }
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8
{ "success": true, }