'js/libs/jquery/jquery.hashchange.js',
'js/libs/fluidbook/fluidbook.utils.js',
'js/libs/fluidbook/fluidbook.support.js',
+ 'js/libs/fluidbook/fluidbook.video.js',
'js/libs/fluidbook/fluidbook.viewport.js',
'js/libs/fluidbook/fluidbook.desktop.js',
'js/libs/fluidbook/fluidbook.service.js',
}
protected function writeCache() {
- $ignore = array('data/l10n/([a-z-]{2,5}).json', '(.*).ogv', '(.*).flv', '(.*).mp4', '(.*).webm');
+ $videosExtensions = array('flv', 'ogv', 'webm', 'mp4');
+ $videos = array('flv' => array(), 'ogv' => array(), 'webm' => array(), 'mp4' => array());
+ $ignore = array('data/l10n/([a-z-]{2,5}).json');
$cacheFile = $this->vdir . '/cache.appcache';
$dest = realpath($this->vdir);
$lines = array();
- $network = array('NETWORK:','*');
+ $network = array('NETWORK:', '*');
$lines[] = 'CACHE MANIFEST';
$lines[] = '# ' . date('Y-m-d H:i:s');
$lines[] = 'index.html* index.html';
$lines[] = '';
$lines[] = 'CACHE:';
- //$lines[] = 'index.html';
$assets = array('images', 'style', 'swf', 'data/l10n', 'data/style', 'data/images', 'data/fluidbook.js');
$pages = $this->book->parametres->pages + 1;
for ($i = 0; $i <= $pages; $i++) {
-
$assets[] = 'data/background/150/' . $this->backgroundsPrefix . $i . '.jpg';
$assets[] = 'data/links/pages/p' . $i . '.html';
$assets[] = 'data/contents/p' . $i . '.svg';
foreach ($ignore as $i) {
if (preg_match('|' . $i . '|i', $p, $matches)) {
continue 2;
+ } else {
+ $ext = strtolower(files::getExtension($p));
+ if (in_array($ext, $videosExtensions)) {
+ $videos[$ext][] = $path->getFilename();
+ continue 2;
+ }
}
}
$lines[] = $p;
$lines = array_merge($lines, $network);
file_put_contents($cacheFile, implode("\n", $lines));
+
+ foreach ($videos as $format => $v) {
+ if (!count($v)) {
+ continue;
+ }
+ $cacheFile = $dest . '/data/links/video.' . $format . '.appcache';
+ $htmlFile = $dest . '/data/links/video.' . $format . '.html';
+
+ $html = '<!DOCTYPE html><html manifest="video.' . $format . '.appcache"><head></head><body></body></html>';
+ file_put_contents($htmlFile, $html);
+
+ $lines = array();
+ $lines[] = 'CACHE MANIFEST';
+ $lines[] = '# ' . date('Y-m-d H:i:s');
+ $lines[] = '';
+ $lines[] = 'CACHE:';
+ foreach ($v as $video) {
+ $lines[] = $video;
+ }
+ file_put_contents($cacheFile, implode("\n", $lines));
+ }
}
protected function writeIndex($numCSS) {
return '';
}
+ public function getAdditionnalContent() {
+
+ }
+
+ public function getClasses(){
+ return array();
+ }
+
public function copyExternalFile($file, $video = false) {
$this->compiler->copyLinkFile($file, 'data/links/', $video);
}
class normalLink extends wsHTML5Link {
public function getHTMLContent() {
- $class = array();
+ $class =$this->getClasses();
if ($this->display_area) {
$class[] = 'displayArea';
}
if (count($class)) {
$c = ' class="' . implode(' ', $class) . '"';
}
- return '<a href="' . $this->getURL() . '" target="' . $this->getTarget() . '"' . $c . '></a>';
+ return '<a href="' . $this->getURL() . '" target="' . $this->getTarget() . '"' . $c . $this->getAdditionnalContent() . '></a>';
}
public function getURL() {
class videoLink extends wsHTML5Link {
public function getHTMLContent() {
- $file = $this->to;
+ $this->copyExternalFile($this->to, true);
+
+ $w = round($this->width * $this->compiler->getCssScale());
+ $h = round($this->height * $this->compiler->getCssScale());
+
+ return self::makeVideoTag($this, $w, $h);
+ }
+
+ public static function makeVideoTag($linkDatas, $w = null, $h = null) {
+ $file = $linkDatas->to;
$e = explode('.', $file);
$ext = array_pop($e);
$basename = implode('.', $e);
- $w = round($this->width * $this->compiler->getCssScale());
- $h = round($this->height * $this->compiler->getCssScale());
- $res = '<div class="videoContainer">';
- $res.='<video width="' . $w . '" height="' . $h . '"';
- if ($this->video_auto_start) {
- $res.=' autoplay="autoplay"';
- }
- $res.=' controls="controls"';
- if (!$this->video_controls) {
- $res.=' onplay="hideControls(this)"';
- }
- if ($this->video_loop) {
- $res.=' onended="this.play();"';
- }
- if (!$this->video_sound_on) {
- $res.=' audio="muted"';
- }
- $res.=' poster="data/links/' . $basename . '.jpg"';
- $res.='>';
- $this->copyExternalFile($this->to, true);
- $types = array('webm' => 'video/webm; codecs="vp8, vorbis"', 'ogv' => 'video/ogg; codecs="theora, vorbis"', 'mp4' => '');
- foreach ($types as $ext => $type) {
- if ($type != '') {
- $type = " type='" . $type . "'";
- }
- $res.='<source src="' . wsHTML5Link::getUniversalLocation($basename . '.' . $ext) . '"' . $type . ' />';
+ $autoplay = ($linkDatas->video_auto_start ? '1' : '0');
+ $controls = ($linkDatas->video_controls ? '1' : '0');
+ $loop = ($linkDatas->video_loop ? '1' : '0');
+ $sound = ($linkDatas->video_sound_on ? '1' : '0');
+
+ $res = '<div class="videoContainer" ';
+ if (!is_null($w) && !is_null($h)) {
+ $res.='data-width="' . $w . '" data-height="' . $h . '" ';
}
- $flashvars = array('video' => '../'.wsHTML5Link::getUniversalLocation($file),
- 'poster' => wsHTML5Link::getUniversalLocation($basename . '.jpg'),
- 'controls' => $this->video_controls == '1',
- 'autoPlay' => $this->video_auto_start == '1',
- 'loop' => $this->video_loop);
- $res.='</video>';
- $res.=cubeMedia::flashObject('swf/video.swf', $w, $h, $flashvars, 'swfplayer-' . $basename, '', 9, '#ffffff', '', 'true', 'noscale', 'normal');
+ $res.=' data-autoplay="' . $autoplay . '"';
+ $res.=' data-controls="' . $controls . '"';
+ $res.=' data-loop="' . $loop . '"';
+ $res.=' data-sound="' . $sound . '"';
+ $res.=' data-name="' . $basename . '"';
+ $res.='></div>';
return $res;
}
}
+class videoPopupLink extends normalLink {
+
+ public function getURL() {
+ $this->copyExternalFile($this->to, true);
+ $file = $this->to;
+ $e = explode('.', $file);
+ $ext = array_pop($e);
+ $basename = implode('.', $e);
+
+ return '#/video/' . $basename;
+ }
+
+ public function getAdditionnalContent() {
+ return ' data-video="'.rawurlencode(videoLink::makeVideoTag($this)).'" ';
+ }
+
+}
+
class webVideoLink extends videoLink {
public function getHTMLContent() {
}
-class videoPopupLink extends normalLink {
-
- public function getURL() {
- $this->copyExternalFile($this->to, true);
- return '#/video/' . $this->to;
- }
-
-}
-
class webVideoPopupLink extends videoPopupLink {
public function getURL() {