}
public function compile() {
- $dirsToCreate = array('data/images', 'data/contents', 'data/background', 'data/thumbnails', 'data/style', 'swf');
+ $dirsToCreate = array('data/images', 'data/contents', 'data/background', 'data/thumbnails', 'data/style');
+ if (in_array('flv', $this->getVideosFormats())) {
+ $dirsToCreate[] = 'swf';
+ }
foreach ($dirsToCreate as $dir) {
$d = $this->vdir . '/' . $dir;
`cp -r $from $to`;
// Copy swf
- copy($this->assets . '/swf/video.swf', $this->vdir . '/swf/video.swf');
+ if (file_exists($this->vdir . '/swf')) {
+ copy($this->assets . '/swf/video.swf', $this->vdir . '/swf/video.swf');
+ }
$this->loadPlugins();
$this->writeImages();
array_push($this->jsFiles, $main);
}
+ protected function getVideosFormats($poster = true) {
+ if ($this->phoenag == 'ios') {
+ $res = array('mp4');
+ } else if ($this->phonegap == 'android') {
+ $res = array('ogv', 'webm');
+ }
+ if (!$this->phonegap) {
+ $res[] = 'flv';
+ }
+ if ($poster) {
+ $res[] = 'jpg';
+ }
+ }
+
protected function writeCache() {
- $videosExtensions = array('flv', 'ogv', 'webm', 'mp4');
- $videos = array('flv' => array(), 'ogv' => array(), 'webm' => array(), 'mp4' => array());
+ $videosExtensions = $this->getVideosFormats(false);
+ foreach ($videosExtensions as $e) {
+ $videos[$e] = array();
+ }
$cacheFile = $this->vdir . '/cache.appcache';
$res[] = $shade;
// Background
- $body = '#main,#view.index{';
+ $body = '#main,.mview.index{';
$body.='background-color:#' . $this->theme->parametres->backgroundColor . ';';
switch ($this->theme->parametres->repeat) {
case wsTheme::REPEAT:
// Menus
# View
- $res[] = '.portrait #view{width:' . $w . ';min-height:' . $h . '}';
- $res[] = '.landscape #view{width:' . $w2 . ';min-height:' . $h . '}';
- $res[] = '#view{background-color:' . self::colorToCSS($this->theme->parametres->couleurB, 1) . ';color:' . self::colorToCSS($this->theme->parametres->subTextColor) . ';}';
+ $res[] = '.portrait .mview{width:' . $w . ';min-height:' . $h . '}';
+ $res[] = '.landscape .mview{width:' . $w2 . ';min-height:' . $h . '}';
+ $res[] = '.mview{background-color:' . self::colorToCSS($this->theme->parametres->couleurB, 1) . ';color:' . self::colorToCSS($this->theme->parametres->subTextColor) . ';}';
# Index
$ratio = $this->width / $this->height;
$thumbh = round(100 / $ratio);
public function copyLinkFile($source, $dest, $video = false) {
$origDir = WS_BOOKS . '/working/' . $this->book_id . '/';
- $types = array('flv', 'mp4', 'ogv', 'webm', 'jpg');
+ $types = $this->getVideosFormats();
if ($video) {
wsTools::encodeWebVideos($origDir . $source, null, true);
$e = explode('.', $source);
protected function preparePackage() {
parent::preparePackage();
- $compiler = wsHTML5Compiler::factory($this->book_id, null, true, $this->vdir);
+ $compiler = wsHTML5Compiler::factory($this->book_id, null, 'ios', $this->vdir);
$compiler->compile();
unlink($this->vdir . '/indext.html');
}
protected function makeResources() {
- $splashs = array('320x480' => 'Default~iphone', '640x960' => 'Default@2x~iphone', '1024x768' => 'Default-Landscape~ipad', '768x1024' => 'Default-Portrait~ipad', '2048x1496' => 'Default-Landscape@2x~ipad', '1536x2008' => 'Default-Portrait@2x~ipad', '640x1136' => 'Default-568h@2x');
+ $splashs = array('320x480' => 'Default~iphone', '640x960' => 'Default@2x~iphone', '1024x748' => 'Default-Landscape~ipad', '768x1004' => 'Default-Portrait~ipad', '2048x1496' => 'Default-Landscape@2x~ipad', '1536x2008' => 'Default-Portrait@2x~ipad', '640x1136' => 'Default-568h@2x~iphone');
$icons = array(57 => 'icon', 72 => 'icon-72', 114 => 'icon@2x', 144 => 'icon-72@2x');
if (!file_exists($this->resources . '/splash')) {