Example #1
0
function get_episode_mediainfo($mediaid){
    $config = get_config('opencast');
    $opencast_client = new opencast_client($config->opencasthost,$config->opencastuser,$config->opencastpass);
    $mediadata = $opencast_client->prepAndSend($config->opencasthost.'/search/episode.json?id='.$mediaid.'&limit=1',array(200),'GET');
   $mediadata = json_decode($mediadata);
    foreach($mediadata as $media){
        $mediinfo = $media->result->mediapackage->media;
        foreach($media->result->mediapackage->media->track as $tracks){
             if($tracks->mimetype=='video/mp4'){
                $media_data = $tracks;
             }
        }
              
    }
    if($media_data)
    return $media_data;
    else
    return false;
}
<?php
ini_set('display_errors','on');
error_reporting(E_ALL);
require_once('../../../config.php');
global $CFG;
require_once $CFG->dirroot.'/mod/opencast/locallib.php';
require_once($CFG->dirroot.'/mod/opencast/opencast-client/client.php');

$options = get_eventslist();
print_object($options);
//
$opencast_client = new opencast_client("http://mh.moodlemenu.net:8080","matterhorn_system_account","opencast");
//$url = 'http://103.241.136.206:8080/users/users.json';
////echo $opencast_client->prepAndSend($url);
//
//echo $events_response = $opencast_client->prepAndSend("http://103.241.136.206:8080/admin-ng/event/events.json");
//$events = json_decode($events_response);
//
//foreach($events->results as $event){
//   $media_response =  $opencast_client->prepAndSend("http://103.241.136.206:8080/admin-ng/event/$event->id/media.json");
//   $media_list = json_decode($media_response);
//   echo $event->title.'<br />';
//   foreach($media_list as $media){
//   echo  "<video width='320' height='240' controls>
//          <source src=$media->url type=$media->mimetype>
//          Your browser does not support the video tag.
//          </video><br />";
//   }
//}  
//
//$reqBody = json_encode(array('username'=>'restuser','password'=>'opencast'));