Changes

Jump to: navigation, search

Engine API/en

1,867 bytes removed, 10:00, 26 December 2012
→‎Исходящие команды
100 - 100% of video has been played
 
== Outgoing commands ==
== Исходящие команды ==
 
<tt>'''HELLOTS'''</tt>
 
response command as a part of handshake procedure
ответная команда в рамках процедуры рукопожатия
 
 
<tt>'''AUTH''' <auth_level></tt>
 
User's access level
Уровень доступа пользователя
 
<tt>auth_level</tt> - целое числоinteger - уровеньaccess доступаlevel
 
At this moment two values of access level are available:
На данный момент возможны два значения уровня доступа:
 
0 - advanced features are not available for user (rewind and playback of torrent files with several video files)
0 - пользователю не доступны расширенные функции (перемотка и проигрывание файлов из торрента с несколькими видео-файлами)
 
1 - advanced features are available for user
1 - пользователю доступны расширенные функции
 
 
<tt>'''STATE''' <state_id></tt>
 
Information about current state of TS Engine
Информация о текущем статусе TS Engine
 
 
<tt>'''SHUTDOWN'''</tt>
 
TS Engine завершилfinished работуits work
 
 
<tt>'''PLAYADI''' <video_url></tt>
 
НачатьStart проигрываниеplaying видеоvideo по ссылкеby video_url link (даннаяthis ссылкаlink ведетleads наto http-серверserver, встроенныйembedded вin TS Engine).
 
<tt>'''PLAY'''</tt> - проигрываниеplayback основногоof видеоthe main video
 
<tt>'''PLAYAD'''</tt> - playback of uninterrupted advertising video (user can't rewind or skip this advertising video)
<tt>'''PLAYAD'''</tt> - проигрывание непрерываемого рекламного ролика (пользователь не может перемотать либо пропустить данный рекламный ролик)
 
<tt>'''PLAYADI'''</tt> - playback of interrupted advertising video (user can rewind or skip this advertising video)
<tt>'''PLAYADI'''</tt> - проигрывание прерываемого рекламного ролика (пользователь может перемотать либо пропустить данный рекламный ролик)
 
 
<tt>'''PAUSE'''</tt>
 
TS Engine began buffering, because there's not enough data for video playback without interruptions
TS Engine начал буферизацию, так как недостаточно данных для проигрывания видео без остановки
 
 
<tt>'''RESUME'''</tt>
 
TS Engine завершилfinished буферизациюbuffering
 
 
<tt>'''LOADRESP''' <request_id> <response></tt>
 
Response to LOAD command
Ответ на команду LOAD
 
<tt>'''request_id'''</tt> - идентификаторrequest запросаidentifier
 
<tt>'''response'''</tt> - списокa файловlist вof форматеfiles in json вformat in такогоthis видаform:
{
"status": 1,
}
 
<tt>'''status'''</tt> - 0: вthere торрентеare нетno видеоvideo файловfiles in torrent, 1 - вthere торрентеis одинone видеоvideo файлfile in torrent, 2 - вthere are more than торрентеone болееvideo одногоfiles видеоin файлаtorrent
 
<tt>'''infohash'''</tt> - infohashtorrent торрентаinfohash
 
<tt>'''files'''</tt> - a list of files; this is an array, each element of which consists of an array with two elements: the first - file's name, the second - file's position in torrent (this position must be sent inside START command to specify which file to download, if there are several of them).
<tt>'''files'''</tt> - список файлов; это массив, каждый элемент в котором состоит из массива из двух элементов: первый - название файла, второй - позиция файла в торренте (эта позиция должна отправляться в команде START для указания, какой именно файл необходимо загружать, если их несколько).
 
ИменаFiles' файловnames передаютсяare вtransferred кодировкеin UTF-8 вencoding in urlencoded видеform.
 
 
<tt>'''INFO''' <message_id>;<message_text></tt>
 
Info message
Информационное сообщение
 
<tt>'''message_id'''</tt> - кодmessage сообщенияcode
 
<tt>'''message_text'''</tt> - текстmessage сообщенияtext
 
 
<tt>'''STATUS''' <status_string></tt>
 
This message is sent periodically to inform client about current state of content download.
Данное сообщение отправляется периодически для информирования клиента о текущем статусе загрузки контента
 
<tt>'''status_string'''</tt> - строкаstring описанногоin нижеformat форматаdescribed below
 
 
If the main content is being played:
Если идет проигрывание основного контента
 
<tt>STATUS main:status_string</tt>
 
 
If advertising video is being played:
Если идет проигрывание рекламного ролика:
 
<tt>STATUS main:status_string|ad:status_string</tt>
<tt>'''status_string:'''</tt>
 
TS Engine ничегоdoes не делаетnothing - <tt>'''idle'''</tt>
 
ошибкаerror - <tt>'''err;error_id;error_message'''</tt> (кодcode иand описаниеdescription)
 
проверкаchecking - <tt>'''check;progress'''</tt>
 
пребуферизацияprebuffering - <tt>'''prebuf;progress;time'''</tt>
 
закачкаdownload - <tt>'''dl'''</tt>
 
буферизацияbuffering - <tt>'''buf;progress;time'''</tt>
 
ожиданиеwaiting достаточнойfor скоростиsufficient speed - <tt>'''wait;time'''</tt>
 
 
КоCommon всемdata is added to all <tt>status_string</tt> (кромеexcept <tt>idle, err, check</tt>) добавляются общие данные:
 
<tt>total_progress;immediate_progress;speed_down;http_speed_down;speed_up;peers;http_peers;downloaded;http_downloaded;uploaded</tt>
 
<tt>'''total_progress'''</tt> - сколькоhow всегоmuch закачаноof поthis данномуfile файлуis downloaded
 
<tt>'''immediate_progress'''</tt> - how much uninterruptible data is downloaded starting from the current position (to show amount of downloaded data)
<tt>'''immediate_progress'''</tt> - сколько непрерывных данных закачано начиная с текущей позиции (для отображения кол-ва закачанного в бегунке)
 
 
ВсеAll числаnumbers передаютсяare какsent as integer.
 
ВсеAll progress принимаютtakes значениеvalues отfrom 0 доto 100.
 
 
'''ПримерыExamples:'''
<tt>STATUS main:prebuf;45;30|ad:buf;69
STATUS main:dl|ad:dl</tt>
 
'''Example of tranformation statuses into text messages that user can understand:'''
'''Пример трансформация статусов в текстовые сообщения, понятные пользователю:'''
 
<tt>check - Checking xx%
buf - Buffering xx%
wait - Waiting sufficient download speed
err - showing an error message
err - выводим сообщение об ошибке
dl, idle - ничегоdoing не выводимnothing</tt>
 
== Events ==

Navigation menu