1
我正在使用PHP上的一些視頻,使用zencoder對視頻進行編碼,將它們保存在s3上,然後在全部完成時通知我的網站。 一切都在工作,直到我必須處理以json形式返回的通知並將新網址提取到已保存的視頻。zencoder通知json
這樣的:
$notification = $zencoder->notifications->parseIncoming();
if($notification->job->state == "finished")
{
$encode_id=$notification->job->id;
}
工作正常。我只需要一些關於訪問url的指針。
發送通知如下:
{
"output": {
"frame_rate": 30.0,
"label": "video_id_",
"total_bitrate_in_kbps": 3115,
"md5_checksum": null,
"channels": "2",
"audio_codec": "aac",
"duration_in_ms": 4225,
"video_codec": "h264",
"url": "http://my_url/597bd3592bf4a9d70f04dc676c44de6d.mp4",
"thumbnails": [{
"label": null,
"images": [{
"url": "http://my_url/_key__0000.png",
"format": "PNG",
"dimensions": "640x360",
"file_size_bytes": 482422
}]
}],
"video_bitrate_in_kbps": 3052,
"width": 640,
"format": "mpeg4",
"height": 360,
"audio_sample_rate": 44100,
"state": "finished",
"audio_bitrate_in_kbps": 63,
"id": 41424918,
"file_size_in_bytes": 1625847
},
"input": {
"frame_rate": 30.0,
"total_bitrate_in_kbps": 3867,
"md5_checksum": null,
"channels": "2",
"audio_codec": "aac",
"duration_in_ms": 4167,
"video_codec": "h264",
"video_bitrate_in_kbps": 3764,
"width": 640,
"format": "mpeg4",
"height": 360,
"audio_sample_rate": 44100,
"state": "finished",
"audio_bitrate_in_kbps": 103,
"id": 22371764,
"file_size_in_bytes": 2028809
},
"job": {
"created_at": "2012-07-14T22:25:08Z",
"test": true,
"updated_at": "2012-07-14T22:25:47Z",
"submitted_at": "2012-07-14T22:25:08Z",
"pass_through": null,
"state": "finished",
"id": 22377083
}
}
但類似:$video_file=$notification->output->url;
沒有。 我錯過了什麼?
$通知 - >輸出 - > URL應如果你正確地使用json_decode()對象,就可以訪問它。當你嘗試訪問$ notification-> output-> url時,你會得到任何錯誤嗎? – 2012-07-15 00:45:28