case 5:
return new internalLink($id, $init, $packager);
case 4:
- return new videoLink($id, $init, $packager);
+ if ($init['inline']) {
+ return new videoLink($id, $init, $packager);
+ } else {
+ return new videoPopupLink($id, $init, $packager);
+ }
case 6:
+ return new multimediaLink($id, $init, $packager);
case 7:
case 8:
case 9:
return null;
case 10:
- return new webVideoLink($id, $init, $packager);
+ if ($init['inline']) {
+ return new webVideoLink($id, $init, $packager);
+ } else {
+ return new webVideoPopupLink($id, $init, $packager);
+ }
case 11:
return new actionLink($id, $init, $packager);
case 12:
return '';
}
- public function copyExternalFile($file) {
- $this->packager->copyLinkFile($file, 'data/links/');
+ public function copyExternalFile($file, $video=false) {
+ $this->packager->copyLinkFile($file, 'data/links/', $video);
}
public function getCSSContainer() {
return 'border:1px dotter #ff0000;';
}
- public static function getUniversalLocation($loc) {
- $target = null;
- parse_url($loc);
+ public static function getUniversalLocation($loc, $css=false) {
+ $datas = parse_url($loc);
- if (!is_null($loc['scheme'])) {
+ if (isset($datas['scheme']) && !is_null($datas['scheme'])) {
return $loc;
} else {
- return 'data/links/' . $loc;
+ if ($css) {
+ return '../links/' . $loc;
+ } else {
+ return 'data/links/' . $loc;
+ }
}
}
class videoLink extends wsPackagerHTML5Link {
public function getHTMLContent() {
+ $file = $this->to;
+ $e = explode('.', $file);
+ $ext = array_pop($e);
+ $basename = implode('.', $e);
+
$res = '<video width="' . $this->width . '" height="' . $this->height . '"';
if ($this->video_auto_start) {
$res.=' autoplay="autoplay"';
if (!$this->video_sound_on) {
$res.=' audio="muted"';
}
+ $res.=' poster="data/links/' . $basename . '.jpg"';
$res.='>';
- $file = $this->to;
- $e = explode('.', $file);
- $ext = array_pop($e);
- $basename = implode('.', $e);
- $types = array('mp4' => 'video/mp4; codecs=\'avc1.42E01E, mp4a.40.2\'', 'ogv' => 'video/ogg; codecs=\'theora, vorbis\'');
+
+ $this->copyExternalFile($this->to, true);
+ $types = array('mp4' => '', 'webm' => 'video/webm; codecs="vp8, vorbis"', 'ogv' => 'video/ogg; codecs="theora, vorbis"');
foreach ($types as $ext => $type) {
- $res.='<source src="' . wsPackagerHTML5Link::getUniversalLocation($basename . '.' . $ext) . '" type="' . $type . '" />';
- $this->copyExternalFile($basename . '.' . $ext);
+ if ($type != '') {
+ $type = " type='" . $type . "'";
+ }
+ $res.='<source src="' . wsPackagerHTML5Link::getUniversalLocation($basename . '.' . $ext) . '"' . $type . '></source>';
}
$res.='</video>';
return $res;
class colorLink extends contentLink {
public function getCSS() {
- return 'background-color:#' . $this->to . ';';
+ return 'background-color:' . wsPackagerHTML5::colorToCSS($this->to) . ';';
}
}
public function getCSS() {
$this->copyExternalFile($this->to);
- return 'background-image:url(../' . wsPackagerHTML5Link::getUniversalLocation($this->to) . ');background-size:100% 100%;background-repeat:no-repeat;';
+ return 'background-image:url(' . wsPackagerHTML5Link::getUniversalLocation($this->to, true) . ');background-size:100% 100%;background-repeat:no-repeat;';
}
}
}
+class multimediaLink extends wsPackagerHTML5Link {
+
+ public function getHTMLContent() {
+ return cubeMedia::flashObject(wsPackagerHTML5Link::getUniversalLocation($this->to), $this->width, $this->height, array(), '', '', 9, '#ffffff', '', 'true', 'noscale', 'transparent');
+ }
+
+}
+
+class videoPopupLink extends normalLink {
+
+ public function getURL() {
+ $this->copyExternalFile($this->to, true);
+ return '#/video/' . $this->to;
+ }
+
+}
+
+class webVideoPopupLink extends videoPopupLink {
+
+ public function getURL() {
+ if ($this->video_service == 0) {
+ $service = 'youtube';
+ } elseif ($this->video_service == 1) {
+ $service = 'dailymotion';
+ }
+ return '#/webvideo/' . $service . '/' . $this->to;
+ }
+
+}
+
?>
mkdir($this->vdir . '/data/images', 0777, true);\r
mkdir($this->vdir . '/data/contents', 0777, true);\r
mkdir($this->vdir . '/data/background', 0777, true);\r
+ mkdir($this->vdir . '/data/thumbnails', 0777, true);\r
mkdir($this->vdir . '/data/style', 0777, true);\r
mkdir($this->vdir . '/data/links/pages', 0777, true);\r
\r
foreach (self::$resolutions as $r) {\r
copy(WS_DOCS . '/' . $infos['document_id'] . '/html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/p' . $page . '.jpg');\r
}\r
+ copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg');\r
}\r
}\r
\r
return $str;\r
}\r
\r
- public function copyLinkFile($source, $dest) {\r
- $s = WS_BOOKS . '/working/' . $this->book_id . '/' . $source;\r
- if (file_exists($s)) {\r
- $d = $this->vdir . '/' . $dest . '/' . $source;\r
- if (!file_exists(dirname($d))) {\r
- mkdir(dirname($d), 0777, true);\r
+ public function copyLinkFile($source, $dest, $video=false) {\r
+\r
+ $origDir = WS_BOOKS . '/working/' . $this->book_id . '/';\r
+ $types = array('mp4', 'ogv', 'webm', 'jpg');\r
+ if ($video) {\r
+ wsTools::encodeWebVideos($origDir . $source, null, false);\r
+ $e = explode('.', $source);\r
+ array_pop($e);\r
+ $base = implode('.', $e);\r
+ $source = array();\r
+ foreach ($types as $type) {\r
+ $source[] = $base . '.' . $type;\r
+ }\r
+ }\r
+\r
+ if (!is_array($source)) {\r
+ $source = array($source);\r
+ }\r
+\r
+ foreach ($source as $so) {\r
+ $s = $origDir . $so;\r
+ fb($s);\r
+ if (file_exists($s)) {\r
+ $d = $this->vdir . '/' . $dest . '/' . $so;\r
+ if (!file_exists(dirname($d))) {\r
+ mkdir(dirname($d), 0777, true);\r
+ }\r
+ copy($s, $d);\r
}\r
- copy($s, $d);\r
}\r
}\r
\r