Skip to content

Commit

Permalink
OHMS-SPRINT-15 Aviary Video Content Support added.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfahadk committed Nov 1, 2019
1 parent 1d384e2 commit af0d1bc
Show file tree
Hide file tree
Showing 7 changed files with 2,414 additions and 5 deletions.
11 changes: 10 additions & 1 deletion app/Ohms/Interview/Version3.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use Ohms\Transcript;
use Ohms\Utils;

class Version3
{
Expand Down Expand Up @@ -38,7 +39,7 @@ private function __construct($viewerconfig, $tmpDir, $cachefile)
} else {
throw new Exception("Initialization requires valid Version3CacheFile.");
}

$this->data = array(
'cachefile' => $cachefile,
'title' => (string)$ohfile->record->title,
Expand Down Expand Up @@ -118,6 +119,14 @@ private function __construct($viewerconfig, $tmpDir, $cachefile)

$players = explode(',', $viewerconfig['players']);
$player = strtolower($this->data['clipsource']);

if($player == 'aviary'){
$this->data['media_url'] = Utils::getAviaryUrl($ohfile->record->media_url);
$player = 'other';
}else{
$this->data['media_url'] = $ohfile->record->media_url;
}

if (in_array($player, $players)) {
$this->data['viewerjs'] = $player;
$this->data['playername'] = $player;
Expand Down
38 changes: 38 additions & 0 deletions app/Ohms/Utils.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace Ohms;

use simple_html_dom;

/**
* Utils Class, Contains commonly used utility Methods.
*/
class Utils {

/**
* Get Parsed URL for Aviary player in particular.
* @param string $embed
* @return string
*/
public static function getAviaryUrl($embed) {

// Create DOM from URL or file
$content = file_get_html($embed);
$mediaURL = "";
if ($content != "") {

$source = $content->find('source', 0);
if ($source) {

if ($source->src) {
$parsedUrl = parse_url($source->src);
$mediaURL = $parsedUrl['scheme'] . "://" . $parsedUrl['host'] . "" . $parsedUrl['path'];
}
}
}
return $mediaURL;
}

}

?>
2 changes: 1 addition & 1 deletion app/init.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../lib/tcpdf_include.php';
require_once __DIR__ . '/../lib/simple_html_dom.php';
3 changes: 3 additions & 0 deletions css/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -1445,4 +1445,7 @@ p.bold {
.printCustom{
display:none;
}
}
.adjust_height{
height: 620px !important ;
}
Loading

0 comments on commit af0d1bc

Please sign in to comment.