Created
May 17, 2016 14:33
-
-
Save otarza/902187774a2640c0c3db1b9537009620 to your computer and use it in GitHub Desktop.
video_transcoder_get_json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function _video_transcoder_get_json($nid){ | |
$node = Node::load($nid); | |
$data = [ | |
"id" => $node->id(), | |
"uuid" => $node->uuid(), | |
"created" => $node->getCreatedTime(), | |
"modified" => $node->getChangedTime(), | |
"date" => "", | |
"type" => "", | |
"duration" => $node->get('field_video_length')->getValue()[0]['value'], | |
"title" => [ | |
'en' => $node->getTitle(), | |
], | |
"description" => [ | |
'en' => "", | |
], | |
"thumbnail" => [ | |
"original" => file_create_url($node->field_video_thumbnail->entity->uri->value), | |
"768p" => NULL, | |
"640p" => NULL, | |
"432p" => NULL, | |
"320p" => NULL, | |
"288p" => NULL, | |
"NNNp" => NULL, | |
], | |
"video" => [ | |
"original" => file_create_url($node->field_video_upload->entity->uri->value), | |
"768p" => NULL, | |
"640p" => NULL, | |
"432p" => NULL, | |
"320p" => NULL, | |
"288p" => NULL, | |
"NNNp" => NULL, | |
], | |
"captions" => [ | |
"en" => NULL, | |
], | |
"embed" => NULL, | |
"shotlist" => [ | |
"url" => file_create_url($node->field_video_shot_list->entity->uri->value), | |
], | |
"channel" => [ | |
"9b9826b4-b513-11e5-9f22-ba0be0483c18" => NULL, | |
], | |
"taxonomy" => [ | |
NULL, | |
], | |
"manifest" => [ | |
"smil" => NULL, | |
"m3u8" => NULL, | |
], | |
"series" => [ | |
"title" => NULL, | |
"episode" => NULL, | |
], | |
]; | |
return json_encode($data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment