방송 예약

라이브 방송 예약은 v12.0부터 사용이 중단되고 2021년 12월 14일부터 모든 버전에서 사용이 중단됩니다. planned_start_time 매개변수를 포함하여 POST /ID/live-video 엔드포인트를 호출하면 오류가 반환됩니다.

라이브 방송 API를 사용하여 생성 날짜부터 최대 7일까지 미리 지정한 시간에 방송되는 라이브 방송을 생성할 수 있습니다.

방송 예약

사용자, 페이지, 그룹 또는 이벤트에 대해 미래의 시작 날짜를 지정하여 라이브 방송을 생성하려면 다음으로 요청을 보내세요.

POST /{node-id}/live_videos?status=SCHEDULED_UNPUBLISHED&planned_start_time={start-time}

planned_start_time 매개변수와 UNIX 타임스탬프를 사용하여 원하는 시작 시간을 표시하세요.

타겟 노드에 LiveVideo 개체가 생성되고 라이브 방송의 secure_stream_urlid가 반환됩니다. 인코더로 이 보안 스트리밍 URL을 사용하여 예약된 시작 시간, 또는 그 전에 라이브 방송 데이터를 LiveVideo 개체로 스트리밍합니다. 방송은 스트리밍 데이터를 받으면 예정된 시작 시간에 노드의 타임라인/피드에 나타납니다.

예약된 방송은 미리 보기를 목적으로 시작 날짜 전 어느 시점에서든 스트리밍 데이터를 수신할 수 있습니다.

요청 샘플

curl -i -X POST \ 
  "https://graph.facebook.com/{page-id}/live_videos?status=SCHEDULED_UNPUBLISHED&planned_start_time=1541539800&access_token={access-token}"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/{page-id}/live_videos",
  new JSONObject("{\"status\":\"SCHEDULED_UNPUBLISHED\",\"planned_start_time\":\"1541539800\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{page-id}/live_videos"
           parameters:@{ @"status": @"SCHEDULED_UNPUBLISHED",@"planned_start_time": @"1541539800",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{page-id}/live_videos',
  'POST',
  {"status":"SCHEDULED_UNPUBLISHED","planned_start_time":"1541539800"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/{page-id}/live_videos',
    array (
      'status' => 'SCHEDULED_UNPUBLISHED',
      'planned_start_time' => '1541539800'
    ),
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 샘플

{
  "id": "10214937378883406",  //LiveVideo object ID
  "stream_url": "rtmp://rtmp-api.facebook...",
  "secure_stream_url": "rtmps://rtmp-api.facebook..."  //Stream URL
}

예약된 방송의 리스트를 가져오려면 예약된 방송 가져오기를 참조하세요.

방송 미리 보기

라이브 방송 API를 사용하여 게시되지 않은 라이브 방송을 미리 볼 수 있습니다. statusSCHEDULED_UNPUBLISHED 또는 UNPUBLISHED로 설정하여 LiveVideo 개체를 생성합니다.

게시되지 않은 라이브 방송을 미리 보려면 다음으로 요청을 보내세요.

GET /{live_video_id}?fields={fields}

{fields} 매개변수를 사용하여 LiveVideo 개체의 dash_preview_url을 가져옵니다.

요청 샘플

curl -i -X GET \
 "https://graph.facebook.com/{live-video-id}
    ?fields=dash_preview_url
     &access_token={access-token}"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/{live-video-id}",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

Bundle parameters = new Bundle();
parameters.putString("fields", "dash_preview_url");
request.setParameters(parameters);
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{live-video-id}"
           parameters:@{ @"fields": @"dash_preview_url",}
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{live-video-id}',
  'GET',
  {"fields":"dash_preview_url"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->get(
    '/{live-video-id}',
    '{fields:dash_preview_url}',    
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 샘플

{
  'dash_preview_url': 'https://video.xx.fbcdn.net/...',
  'id': '{live-video-id}'
}

그 결과로 라이브 방송의 dash_preview_urlid가 반환됩니다. URL을 복사해서 Dash Player에 붙여넣으면 방송을 미리 볼 수 있습니다.

타사 테스트 플레이어로 방송을 미리 보는 것도 방송 콘텐츠를 확인하는 좋은 방법이지만 테스트 페이지에서 방송하는 것을 권장합니다. 테스트 페이지에서 방송하려면 페이지 관리자이거나 편집자여야 합니다. 또한 공개 범위 매개변수를 설정하여 자신에게만 보이는 스트리밍을 생성할 수도 있습니다.

예약된 방송 가져오기

사용자, 페이지, 그룹 또는 이벤트에 대해 예약된 방송 리스트를 가져오려면 publish_video 권한이 있는 적절한 액세스 토큰을 가져와 다음으로 요청을 보내세요.

GET /{node-id}/live_videos?broadcast_status=["SCHEDULED_UNPUBLISHED"]

broadcast_status 값은 배열이어야 합니다. 추가 값의 전체 리스트는 LiveVideo 참고 자료를 참조하세요.

페이지의 샘플 방송 리스트

curl -i -X GET \ 
  "https://graph.facebook.com/{page-id}/live_videos?broadcast_status=["SCHEDULED_UNPUBLISHED"]&access_token={access-token}"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/{page-id}/live_videos",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

Bundle parameters = new Bundle();
parameters.putString("broadcast_status", "["SCHEDULED_UNPUBLISHED"]");
request.setParameters(parameters);
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{your-page-id}/live_videos"
           parameters:@{ @"broadcast_status": @"["SCHEDULED_UNPUBLISHED"]",}
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{page-id}/live_videos',
  'GET',
  {"broadcast_status":"[\"SCHEDULED_UNPUBLISHED\"]"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->get(
    '/{your-page-id}/live_videos',
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 샘플

{
  "data": [
    {
      "status": "SCHEDULED_UNPUBLISHED",
      "stream_url": "rtmp://rtmp-api-dev.facebook.com:80/rtmp/...",
      "secure_stream_url": "rtmps://rtmp-api-dev.facebook.com:443/rtmp/...",
      "embed_html": "<iframe src=\"https://www.facebook.com/plugins/video.php?...",
      "id": "10214937378883406 "  //LiveVideo object ID
    }
  ]
}

방송 재예약

예약된 방송의 시작 시간을 변경하려면 다음으로 요청을 보내세요.

POST /{live-video-id}?planned_start_time={new-start-time}

{new-start-time} 값은 새로운 시작 시간을 나타내는 UNIX 타임스탬프여야 합니다. 요청이 성공하면 API가 LiveVideo 개체의 ID로 응답합니다.

페이지의 샘플 라이브 방송

curl -i -X POST \
  "https://graph.facebook.com/{live-video-id}?planned_start_time=1541540800&access_token={access-token}"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/{live-video-id}",   
  new JSONObject("{\"planned_start_time\":\"1541540800\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{live-video-id}"    
           parameters:@{ @"planned_start_time": @"1541540800",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{live-video-id}', 
  'POST',
  {"planned_start_time":"1541540800"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/{live-video-id}', 
    array (
      'planned_start_time' => '1541540800'
    ),
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

응답 예시

{
  "id": "10214937378883406"
}

방송 즉시 시작

방송을 즉시 시작하려면 다음으로 요청을 보내세요.

POST /{live-video-id}?status=LIVE_NOW

방송을 나타내는 LiveVideo 개체와 연결된 스트리밍 URL이 스트리밍 데이터를 수신하면 방송이 시작됩니다. 요청이 성공하면 API가 LiveVideo 개체의 ID로 응답합니다.

요청 샘플

curl -i -X POST \
 "https://graph.facebook.com/{live-video-id}?status=LIVE_NOW&access_token={access-token}"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/{live-video-id}",
  new JSONObject("{\"status\":\"LIVE_NOW\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{live-video-id}"
           parameters:@{ @"status": @"LIVE_NOW",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{live-video-id}',
  'POST',
  {"status":"LIVE_NOW"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->post(
    '/{live-video-id}',
    array (
      'status' => 'LIVE_NOW'
    ),
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

JSON 응답 예시

{
  "id": "10214937378883406"
}