Bỏ qua

Tạo job sự kiện

Mô tả: Tạo mới một job cho truyền hình tuyến tính (linear TV)

POST https://lms-api.swiftfederation.com/v7.4.0/live_event_job

Yêu cầu (Request)

  • Header

  • Body

Trường Bắt buộc Kiểu dữ liệu Mô tả
app M String Tên ứng dụng. Phải là duy nhất và không được trùng với các khách hàng khác. Chỉ cho phép chữ cái, số và dấu gạch dưới (_).
stream M String Tên luồng. Chỉ cho phép chữ cái, số và dấu gạch dưới (_).
inbound M Object Tham khảo đối tượng inbound.
outbound_protocols M Mảng chuỗi (Array of String) Các định dạng luồng phát ra mong muốn: "rtmp", "http-flv", "hls" và "dash".
presets M Mảng chuỗi (Array of String) Danh sách preset mã hóa live stream. Các preset đặc biệt: 'transmux', 'audio_only'.
gpu_transcoding O Boolean Bật/tắt việc sử dụng GPU để transcoding. Mặc định là tắt (sử dụng CPU).
drm O Mảng chuỗi (Array of String) Bật DRM cho các định dạng phát ra cụ thể. Các lựa chọn: 'hls-aes128', 'hls-fairplay', 'dash-aes128', 'dash-widevine'. Có thể chọn nhiều.
drm_resource_id O(M) String Nếu drm không rỗng, drm_resource_id bắt buộc phải có.
recording O Boolean Bật ghi hình live stream VAS. Mặc định là false.
recording_format O(M) String Định dạng file ghi hình, giá trị "hls" hoặc "mp4".
recording_storage O(M) String Thông tin lưu trữ file ghi hình. Ví dụ:
ftp://{file_transfer_name}:{path}
sftp://{file_transfer_name}:{path}
lfd://{LFD_Name}:{path}
screenshot O Boolean Bật chụp ảnh màn hình live stream VAS. Mặc định là false.
screenshot_format O(M) String Định dạng ảnh, hiện tại chỉ hỗ trợ "jpg".
screenshot_storage O(M) String Thông tin lưu trữ file ảnh chụp màn hình. Ví dụ:
ftp://{file_transfer_name}:{path}
sftp://{file_transfer_name}:{path}
lfd://{LFD_Name}:{path}

Phản hồi (Response)

  • Header

  • Body

Trường Kiểu dữ liệu Mô tả
request_id String ID duy nhất của yêu cầu HTTP hiện tại.
job Object Tham khảo Đối tượng Job (Job Object).

Ví dụ

  • Trường hợp phổ biến
  • Yêu cầu (Request)

POST https://lms-api.swiftfederation.com/v7.4.0/live_event_job
Content-Type: application/json; charset=UTF-8
Authorization: ...

{
     "app": "a2021091702",
     "stream": "s20210917",
     "inbound": {
          "protocol": "rtmp"
     },
     "outbound_protocols": [
          "hls"
     ],
     "presets": [
          "transmux",
          "360H"
     ]
}
  • Bật ghi hình (Enable recording)
  • Yêu cầu (Request)

POST https://lms-api.swiftfederation.com/v7.4.0/live_event_job
Content-Type: application/json; charset=UTF-8
Authorization: ...

{
  "app": "a2021091702",
  "stream": "s20210917",
  "inbound": {
       "protocol": "rtmp"
  },
  "outbound_protocols": [
       "hls"
  ],
  "presets": [
       "transmux",
       "360H"
  ],
  "recording": true,
  "recording_format": "hls",
  "recording_storage": "ftp://recording_ftp:/20210916"
}
  • Bật DRM (Enable DRM)
  • Yêu cầu (Request)

POST https://lms-api.swiftfederation.com/v7.4.0/live_event_job
Content-Type: application/json; charset=UTF-8
Authorization: ...

{
     "app": "a2021092306",
     "stream": "s20210923",
     "inbound": {
          "protocol": "rtmp"
     },
     "outbound_protocols": [
          "hls"
     ],
     "presets": [
          "transmux",
          "360H"
     ],
     "drm": "hls-aes128",
     "drm_resource_id": "123456"
}
  • Bật chụp ảnh màn hình (Enable live screenshot)
  • Yêu cầu (Request)

POST https://lms-api.swiftfederation.com/v7.4.0/live_event_job
Content-Type: application/json; charset=UTF-8
Authorization: ...

{
  "app": "a2021091702",
  "stream": "s20210917",
  "inbound": {
       "protocol": "rtmp"
  },
  "outbound_protocols": [
       "hls"
  ],
  "presets": [
       "transmux",
       "360H"
  ],
  "screenshot": true,
  "screenshot_format": "jpg",
  "screenshot_storage": "lfd://screenshot_lfd:/pub/20210916"
}
  • Phản hồi (Response)
{
     "request_id": "ef78eb18b59c4144a8c170aef1ba7d68.39.16318695552410049",
     "job": {
          "app": "a2021091702",
          "stream": "s20210917",
          "ingestion": {
               "protocol": "rtmp",
               "url": "rtmp://192.168.1.25/a2021091702/s20210917?token=1631955955-c0db75c7844e5f1c8c0f86f1fd9a3aa5"
          },
          "origin": [
               {
                    "protocol": "hls",
                    "manifest": "/a2021091702/s20210917_ma.m3u8",
                    "playlist": [
                         {
                              "preset": "transmux",
                              "uri": "/a2021091702/s20210917-transmux.m3u8"
                         },
                         {
                              "preset": "360H",
                              "uri": "/a2021091702/s20210917-360H.m3u8"
                         }
                    ]
               }
          ]
     }
}