Changes

Jump to: navigation, search

Engine HTTP API

421 bytes added, 22:55, 19 April 2018
API methods
==About==
Since version 3.1 we implemented API to control app engine via HTTP. To do that, you should send appropriate HTTP GET query to the app engine (default IP:port is 127.0.0.1:6878)
==Limitations==
Some examples:
1. Query:
<nowiki>
Query:
http://127.0.0.1:6878/webui/api/service?method=get_version&format=jsonp&callback=mycallback
*'''code''' - engine version, integer (30012)
2. Simple page with check button (JSONP-queries served by jQuery):
<nowiki><!DOCTYPE html>
<html>
</body>
</html></nowiki>
 
==Using HTTP API on Android==
HTTP API is a preferred way to integrate engine with other applications on Android.
 
Before sending any requests to engine you should ensure that it is running. This should be done by binding to engine service as described
[[Using_Ace_Stream_as_service_on_Android|here]].
==API methods==
Terms: <tt>''<engine_address>''</tt> - app engine IP address, <tt>''<engine_port>''</tt> - app engine HTTP port.
Common params:
*'''sid''' - [[#player id|player id]] (optional)
*'''id''' - content id (conditional param)
*'''infohash''' - transport file infohash (.acelive or .torrent file) (conditional param)
*'''url''' - link to transport file (conditional param). Can be used with URL encoded "file://path/" to access local file.*'''pathpid''' - local path to transport file [[#Player ID|player id]] (conditional paramoptional, formerly known as '''sid''', since ver. 3.1.29 is obsolete and replaced by '''pid''')
In the query to the app engine at least one of params <tt>id</tt>, <tt>infohash</tt>, <tt>url</tt>, <tt>path</tt> must be present.
===How to get HLS stream===
Query:<tt><nowiki>http://<engine_address>:<engine_port>/ace/manifest.m3u8</nowiki></tt>
As response app engine should return HLS playlist. If any error occured, then engine return HTTP error code 4хх or 5хх with brief error description.
===How to get HTTP stream===
Query:<tt><nowiki>http://<engine_address>:<engine_port>/ace/getstream</nowiki></tt>
As response app engine should return stream data as http progressive download. If any error occured, then engine return HTTP error code 4хх or 5хх with brief error description.
===How to play HLS broadcast===
Query:<tt><nowiki>http://<engine_address>:<engine_port>/hls/manifest.m3u8</nowiki></tt>
You can play via app engine any HLS broadcast, just pass link to the HLS playlist to the engine (<tt>manifest_url</tt> param).
Example:
<nowiki>
Query:
http://127.0.0.1:6878/ace/event/5410b27fc567c35c8547e3b69b141215ce3a1fd7/ef0609c43e560697329d93dae4571edb
If some permits is not granted, then engine playback can be stopped:
* at the playback start:
<nowiki>Start playback:
http://127.0.0.1:6878/ace/manifest.m3u8?id=c894b23a65d64a0dae2076d2a01ec6bface83b01&format=json&use_stop_notifications=1
{
==Player ID==
Player ID ('''pid''') - random string, used for impersonate player identification during engine connect session. "Player ID " purpose - app engine should must distinguish one player session from another, as in the current engine implementation user cannot play the same live-stream with two (or more) players simultaneously from one engine, and engine will stop to serve requests from one player, when got a new request from another.

Navigation menu