From: vincent@cubedesigners.com Date: Fri, 15 Jul 2011 01:31:45 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=e83376b84e3c943308be76b9ec15bd802089a2e0;p=cubeextranet.git --- diff --git a/fluidbook/tools/webvideo b/fluidbook/tools/webvideo index 08781a862..18f401131 100644 --- a/fluidbook/tools/webvideo +++ b/fluidbook/tools/webvideo @@ -5,5 +5,7 @@ extension=${filename##*.} filename=${filename%.*} +/usr/local/bin/ffmpeg -i $1 -y -r 1 -ss 00:00:04 -t 00:00:01 -f image2 $2/$filename.jpg +/usr/local/bin/ffmpeg -i $1 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -vcodec libvpx -b 614400 -acodec libvorbis -y $2/$filename.webm /usr/bin/ffmpeg -i $1 -y -acodec aac -ab 128k -vcodec libx264 -b 1200k -mbd 2 -cmp 2 -subcmp 2 -strict experimental $2/$filename.mp4 /usr/local/bin/ffmpeg2theora $1 -o $2/$filename.ogv \ No newline at end of file diff --git a/inc/ws/Util/class.ws.tools.php b/inc/ws/Util/class.ws.tools.php index faf132aa9..c1749b5ee 100644 --- a/inc/ws/Util/class.ws.tools.php +++ b/inc/ws/Util/class.ws.tools.php @@ -8,7 +8,7 @@ class wsTools { } $log = $dir . '/' . cubeFiles::getName($file) . '.log'; - if (!$force && file_exists($log)) { + if (!$force && file_exists($log) && filemtime($log) > filemtime($file)) { return; } @@ -17,7 +17,7 @@ class wsTools { if ($async) { $webvideo->setNohup(true); } - $webvideo->setArg(null, $dest); + $webvideo->setArg(null, $file); $webvideo->setArg(null, $dir); $webvideo->execute(); } diff --git a/inc/ws/Util/packager/class.ws.packager.php b/inc/ws/Util/packager/class.ws.packager.php index 00543ecbb..16e254cb0 100644 --- a/inc/ws/Util/packager/class.ws.packager.php +++ b/inc/ws/Util/packager/class.ws.packager.php @@ -13,6 +13,7 @@ class wsPackager { protected $daoBook; public static function package($book_id, $version) { + cubePHP::neverStop(); if ($version == 'html') { $packager = new wsPackagerHTML($book_id); } elseif ($version == 'win-exe') { diff --git a/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php b/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php index 1b68c923a..9a2519462 100644 --- a/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php +++ b/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php @@ -35,14 +35,23 @@ class wsPackagerHTML5Link { 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: @@ -76,8 +85,8 @@ class wsPackagerHTML5Link { 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() { @@ -93,14 +102,17 @@ class wsPackagerHTML5Link { 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; + } } } @@ -181,6 +193,11 @@ class internalLink extends normalLink { class videoLink extends wsPackagerHTML5Link { public function getHTMLContent() { + $file = $this->to; + $e = explode('.', $file); + $ext = array_pop($e); + $basename = implode('.', $e); + $res = ''; return $res; @@ -248,7 +266,7 @@ class basketLink extends wsPackagerHTML5Link { class colorLink extends contentLink { public function getCSS() { - return 'background-color:#' . $this->to . ';'; + return 'background-color:' . wsPackagerHTML5::colorToCSS($this->to) . ';'; } } @@ -257,7 +275,7 @@ class imageLink extends contentLink { 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;'; } } @@ -275,4 +293,34 @@ class fileLink extends normalLink { } +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; + } + +} + ?> diff --git a/inc/ws/Util/packager/html5/class.ws.packager.html5.php b/inc/ws/Util/packager/html5/class.ws.packager.html5.php index 3a4cc7170..7770b83c8 100644 --- a/inc/ws/Util/packager/html5/class.ws.packager.html5.php +++ b/inc/ws/Util/packager/html5/class.ws.packager.html5.php @@ -58,6 +58,7 @@ class wsPackagerHTML5 extends wsPackager { mkdir($this->vdir . '/data/images', 0777, true); mkdir($this->vdir . '/data/contents', 0777, true); mkdir($this->vdir . '/data/background', 0777, true); + mkdir($this->vdir . '/data/thumbnails', 0777, true); mkdir($this->vdir . '/data/style', 0777, true); mkdir($this->vdir . '/data/links/pages', 0777, true); @@ -149,6 +150,7 @@ class wsPackagerHTML5 extends wsPackager { foreach (self::$resolutions as $r) { copy(WS_DOCS . '/' . $infos['document_id'] . '/html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/p' . $page . '.jpg'); } + copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg'); } } @@ -565,14 +567,35 @@ class wsPackagerHTML5 extends wsPackager { return $str; } - public function copyLinkFile($source, $dest) { - $s = WS_BOOKS . '/working/' . $this->book_id . '/' . $source; - if (file_exists($s)) { - $d = $this->vdir . '/' . $dest . '/' . $source; - if (!file_exists(dirname($d))) { - mkdir(dirname($d), 0777, true); + public function copyLinkFile($source, $dest, $video=false) { + + $origDir = WS_BOOKS . '/working/' . $this->book_id . '/'; + $types = array('mp4', 'ogv', 'webm', 'jpg'); + if ($video) { + wsTools::encodeWebVideos($origDir . $source, null, false); + $e = explode('.', $source); + array_pop($e); + $base = implode('.', $e); + $source = array(); + foreach ($types as $type) { + $source[] = $base . '.' . $type; + } + } + + if (!is_array($source)) { + $source = array($source); + } + + foreach ($source as $so) { + $s = $origDir . $so; + fb($s); + if (file_exists($s)) { + $d = $this->vdir . '/' . $dest . '/' . $so; + if (!file_exists(dirname($d))) { + mkdir(dirname($d), 0777, true); + } + copy($s, $d); } - copy($s, $d); } }