Graph API 版本

Page Live Videos

閱讀中

Page Live Videos

Requirements

For Pages you own or for which you can perform the MODERATE task, you will need:

For Pages you do not own or for which you cannot perform the MODERATE task, you will need:

當使用專頁公開內容存取權限功能時,請使用系統用戶存取憑證以免傳輸率限制的問題。

新版專頁體驗

This endpoint is supported for 新版專頁體驗.

Feature Permissions

名稱說明
專頁公開內容存取權限This feature permission may be required.

例子

Graph API Explorer
GET /v19.0/{page-id}/live_videos HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{page-id}/live_videos',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{page-id}/live_videos",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{page-id}/live_videos",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{page-id}/live_videos"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
如果想了解如何使用 Graph API,請參閱我們的使用 Graph API 指南

參數

參數描述
broadcast_status
list<enum {UNPUBLISHED, LIVE, LIVE_STOPPED, PROCESSING, VOD, SCHEDULED_UNPUBLISHED, SCHEDULED_LIVE, SCHEDULED_EXPIRED, SCHEDULED_CANCELED}>

Allows you to specify what kind of live videos return. No value returns all status types

source
enum{target, owner}
預設值:target

Specifies what the source of the videos should be. 'target' gets videos broadcasted onto the page's timeline, 'owner' gets videos made by the page. (Note: When the source is set to 'target', unpublished videos will not be returned as they do not have an assigned target at that point.)

欄位

由此關係連線進行的閱讀將回傳 JSON 格式結果:

{ "data": [], "paging": {} }

data

LiveVideo 節點的清單。

paging

如需更多有關分頁的詳細資料,請參閱 Graph API 指南

Error Codes

錯誤說明
100Invalid parameter
190Invalid OAuth 2.0 Access Token
200Permissions error
210User not visible

建立中

You can make a POST request to live_videos edge from the following paths:
發佈到此關係連線時,會建立 a LiveVideo

12.0 版中已停用直播視像排程的功能,所有版本將於 2021 年 12 月 14 日停用此功能。如果使用 planned_start_time 參數呼叫 POST /ID/live-video 端點,系統便會傳回錯誤提示。

參數

參數描述
content_tags
list<numeric string>

Tags that describe the contents of the video. Use search endpoint with type=adinterest to get possible IDs.

                                                  Example:
                                                  ~~~~
                                                  /search?type=adinterest&q=couscous
                                                  ~~~~

crossposting_actions
array<JSON object>

List of desired changes to crossposting for this broadcast. Each change must provide a page_id and action. Example:

[ {page_id: 1234, action: 'enable_crossposting'}, {page_id: 4567, action: 'enable_crossposting_and_create_post'} ]

Available action types:

  • enable_crossposting: Enables crossposting for this broadcast with the Page if it is not currently enabled. No change if crossposting is already enabled with the Page for this broadcast.
  • disable_crossposting: Disables crossposting for this broadcast with the Page if it is currently enabled. No change if crossposting is not already enabled with the Page for this broadcast.
  • enable_crossposting_and_create_post: Same as enable_crossposting, but will also create a post as the Page. The post will be created even if crossposting is already enabled for the Page. This option is subject to your live crossposting relationships and will fail for Pages without the required permission.

When used with a Live Online Event, this will apply to the event.

page_id
page ID

page_id

必填
action
enum {ENABLE_CROSSPOSTING, DISABLE_CROSSPOSTING, ENABLE_CROSSPOSTING_AND_CREATE_POST}

action

必填
custom_labels
list<string>

Labels used to describe the video. Unlike content tags, custom labels are not published and only appear in insights data.

description
UTF-8 string

The description of the live video.

支援表情符號
donate_button_charity_id
numeric string or integer

Specifies the ID of the charity for which a donate button will be added to the live video.

enable_backup_ingest
boolean

Set this to true to enable a backup ingest url. stop_on_delete_stream defaults to false when set

encoding_settings
string

Identifier of the encoding settings group the broadcaster is using for this stream. This parameter is currently only in use for live-360 broadcasts. The value to be passed to this parameter is the value of the identifier key of the encoding settings preset. Encoding presets can be found by querying the /broadcaster_encoding_settings Graph API endpoint (GET query).

event_params
Live Video Event Parameter

Parameters specific to Live Online Event broadcast. If start_time (unix timecode) is set, LOE's start time will be updated. Also, cover (url) uploads an image to use as the cover photo for the event.

Example: { start_time: 1641013200, cover: 'https://your.url/image.jpg', }

fisheye_video_cropped
boolean

Whether the single fisheye video is cropped or not

front_z_rotation
float

The front z rotation in degrees on the single fisheye video

game_show
JSON object

Configure this live stream to be a game show

game_type
enum {KNOCKOUT}

game_type

必填
is_spherical
boolean

Flag that denotes the broadcast is a 360 live broadcast.

original_fov
int64

Original field of view of the camera

privacy
Privacy Parameter

Privacy for this live video.

product_items
list<numeric string>

Products which will be shown with live videos.

projection
enum {EQUIRECTANGULAR, CUBEMAP, HALF_EQUIRECTANGULAR}

Flag that denotes expected projection for 360 live streams. The default value is EQUIRECTANGULAR.

published
boolean

Set this to false to preview the stream before going live.

                                                  Deprecated. Prefer setting the status instead.

schedule_custom_profile_image
image

Custom image that will appear in the scheduled live story and lobby.

spatial_audio_format
enum {ambiX_4}

Denotes the format of the spatial audio stream. When unspecified audio is presumed to be mono or stereo.

status
enum {UNPUBLISHED, LIVE_NOW, SCHEDULED_UNPUBLISHED, SCHEDULED_LIVE, SCHEDULED_CANCELED}

The status of the broadcast. A LIVE_NOW broadcast is currently live and visible to users. An UNPUBLISHED broadcast is in preparation; it's not visible to other users, and it may be automatically deleted after several hours in this state. (Consider using the SCHEDULED states to create a planned, future broadcast.)

stereoscopic_mode
enum {MONO, LEFT_RIGHT, TOP_BOTTOM}

Set this parameter to the stereoscopic mode for this video.

stop_on_delete_stream
boolean

Set this to true if stream should be stopped when deleteStream RTMP command received.

targeting
target

Object that limits the audience for this content. Anyone not in these demographics will not be able to view this content.

When used with a Live Online Event, this will apply to the event.

geo_locations
Object

countries
list<string>

regions
list<Object>

key
int64

cities
list<Object>

key
int64

zips
list<Object>

key
string

locales
list<string>

excluded_countries
list<string>

excluded_regions
list<int64>

excluded_cities
list<int64>

excluded_zipcodes
list<string>

timezones
list<int64>

age_min
enum {13, 15, 18, 21, 25}

title
UTF-8 string

The title of the live video. Maximum 254 characters.

支援表情符號

傳回類型

此端點支援寫入後讀取功能,並將讀取傳回類型表示為 id 的節點。
Struct {
id: numeric string,
stream_url: string,
secure_stream_url: string,
stream_secondary_urls: List [
string
],
secure_stream_secondary_urls: List [
string
],
dash_ingest_url: string,
dash_ingest_secondary_urls: List [
string
],
event_id: numeric string,
}

Error Codes

錯誤說明
200Permissions error
368The action attempted has been deemed abusive or is otherwise disallowed
100Invalid parameter
190Invalid OAuth 2.0 Access Token
1000Invalid time for an event.
1005Fail to upload cover photo.
102Session key invalid or no longer valid

更新中

你無法在此端點執行此操作。

正在刪除

你無法在此端點執行此操作。