Skip to content

Instantly share code, notes, and snippets.

@otarza
Created May 17, 2016 14:33
Show Gist options
  • Save otarza/902187774a2640c0c3db1b9537009620 to your computer and use it in GitHub Desktop.
Save otarza/902187774a2640c0c3db1b9537009620 to your computer and use it in GitHub Desktop.
video_transcoder_get_json
<?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