diff --git a/README.md b/README.md index 3762fe3c..685ba448 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ The main purpose of ffplayout is to provide a 24/7 broadcasting solution that pl - **stream** - **desktop** - **HLS** +- JSON RPC server, for getting infos about current playing and controlling. Requirements ----- @@ -126,6 +127,53 @@ out: -hls_segment_filename /var/www/html/live/stream-%09d.ts /var/www/html/live/stream.m3u8 ``` +JSON RPC +----- + +The ffplayout engine can run a JSON RPC server. A request show look like: + +```Bash +curl -X POST -H "Content-Type: application/json" -H "Authorization: ---auth-key---" \ + -d '{"jsonrpc": "2.0", "method": "player", "params":{"control":"next"}, "id":1 }' \ + 127.0.0.1:7070 +``` + +At the moment this comments are possible: + +```Bash +'{"jsonrpc": "2.0", "method": "player", "params":{"media":"current"}, "id":1 }' # get infos about current clip +'{"jsonrpc": "2.0", "method": "player", "params":{"control":"next"}, "id":1 }' # jump to next clip +'{"jsonrpc": "2.0", "method": "player", "params":{"control":"back"}, "id":1 }' # jump to last clip +'{"jsonrpc": "2.0", "method": "player", "params":{"control":"reset"}, "id":1 }' # reset playlist to old state + +``` + +Output from `{"media":"current"}` show: + +```JSON +{ + "jsonrpc": "2.0", + "result": { + "current_media": { + "category": "", + "duration": 154.2, + "out": 154.2, + "seek": 0.0, + "source": "/opt/tv-media/clip.mp4" + }, + "index": 39, + "play_mode": "playlist", + "played_sec": 67.80771999300123, + "remaining_sec": 86.39228000699876, + "start_sec": 24713.631999999998, + "start_time": "06:51:53.631" + }, + "id": 1 +} + +``` + + Installation ----- diff --git a/assets/ffplayout.yml b/assets/ffplayout.yml index 52be5b88..028eefba 100644 --- a/assets/ffplayout.yml +++ b/assets/ffplayout.yml @@ -18,13 +18,13 @@ mail: help_text: Send error messages to email address, like missing playlist; invalid json format; missing clip path. Leave recipient blank, if you don't need this. 'mail_level' can be INFO, WARNING or ERROR. 'interval' means seconds until a new mail will be sended. - subject: "Playout Error" - smtp_server: "mail.example.org" + subject: Playout Error + smtp_server: mail.example.org starttls: true - sender_addr: "ffplayout@example.org" + sender_addr: ffplayout@example.org sender_pass: "abc123" recipient: - mail_level: "ERROR" + mail_level: ERROR interval: 30 logging: @@ -37,9 +37,9 @@ logging: backup_count: 7 local_time: true timestamp: true - log_path: "/var/log/ffplayout/" - log_level: "DEBUG" - ffmpeg_level: "error" + log_path: /var/log/ffplayout/ + log_level: DEBUG + ffmpeg_level: error processing: help_text: Default processing, for all clips that they get prepared in that way, @@ -57,10 +57,10 @@ processing: aspect: 1.778 fps: 25 add_logo: true - logo: "docs/logo.png" + logo: docs/logo.png logo_scale: logo_opacity: 0.7 - logo_filter: "overlay=W-w-12:12" + logo_filter: overlay=W-w-12:12 add_loudnorm: false loud_i: -18 loud_tp: -1.5 @@ -84,7 +84,7 @@ playlist: should always start at the begin. 'length' represent the target length from playlist, when is blank real length will not consider. 'infinit true' works with single playlist file and loops it infinitely. - path: "/playlists" + path: /playlists day_start: "5:59:25" length: "24:00:00" infinit: false