我正在尝试通过我的应用程序使用 PHP 在bright cove网站上制作一个实时视频事件,根据他们使用 cURL 并获得成功回应。我使用以下cURL命令发送请求。
function createLiveEvent() {
$api = $_POST['api_key'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.bcovlive.io/v1/jobs");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{"
. "\n \"live_stream\": true,"
. "\n \"region\": \"us-west-2\","
. "\n \"reconnect_time\": 1800,"
. "\n \"live_sliding_window_duration\": 57600,"
. "\n \"outputs\": ["
. "\n {"
. "\n \"label\": \"hls720p\","
. "\n \"live_stream\": true,"
. "\n \"width\": 1280,"
. "\n \"height\": 720,"
. "\n \"video_codec\": \"h264\","
. "\n \"h264_profile\": \"high\","
. "\n \"video_bitrate\": 2100,"
. "\n \"segment_seconds\": 4,"
. "\n \"keyframe_interval\": 60\n },"
. "\n {\n \"label\": \"hls540p\","
. "\n \"live_stream\": true,"
. "\n \"width\": 960,\n \"height\": 540,"
. "\n \"video_codec\": \"h264\","
. "\n \"h264_profile\": \"main\","
. "\n \"video_bitrate\": 1500,"
. "\n \"segment_seconds\": 4,"
. "\n \"keyframe_interval\": 60\n },"
. "\n {\n \"label\": \"hls360p\","
. "\n \"live_stream\": true,\n \"width\": 640,"
. "\n \"height\": 360,\n \"video_codec\": \"h264\","
. "\n \"h264_profile\": \"main\","
. "\n \"video_bitrate\": 800,"
. "\n \"segment_seconds\": 4,"
. "\n \"keyframe_interval\": 60\n }\n ]\n}\n");
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = "Cache-Control: no-cache";
$headers[] = "Content-Type: application/json";
$headers[] = "Postman-Token: postman_token";
$headers[] = "X-Api-Key: " . $api;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
wp_send_json($result);
}
我收到了回复,但我无法在明亮的海湾上看到我的帐户中的直播活动。我有点陷在这一点上,我在这里错过了什么或做错了什么。