} elseif ($this->phonegap == 'ios') {
$res = array('mp4');
} else if ($this->phonegap == 'android') {
- $res = array('ogv', 'webm');
+ $res = array('webm');
}
if ($poster) {
}
protected function writeCache() {
+ if ($this->phonegap) {
+ return;
+ }
+
$videosExtensions = $this->getVideosFormats(false);
foreach ($videosExtensions as $e) {
$videos[$e] = array();
}
protected function writeConfig() {
-
$this->config->numerotation = explode(',', $this->book->numerotation);
$this->config->id = $this->book->book_id;
$this->config->cacheDate = TIME;
$this->config->chapters = $this->book->chapters;
$this->config->coquilletteBack = $this->colorToCSS($this->theme->parametres->couleurA);
$this->config->coquilletteFront = $this->colorToCSS($this->theme->parametres->arrowsColor);
+ $this->config->videoFormats = $this->getVideosFormats(false);
foreach ($this->additionalConfig as $k => $v) {
$this->config->$k = $v;
}
protected $resources = '';
protected $makeResources = true;
- protected $os = 'ios';
+ protected $os = 'all';
+ protected $supportedOS = array('ios', 'android');
- public function __construct($book_id, $vdir = null, $whole = true, $makeResources = true, $os = 'ios') {
+ public function __construct($book_id, $vdir = null, $whole = true, $makeResources = true, $os = 'all') {
$this->makeResources = $makeResources;
$this->os = $os;
parent::__construct($book_id, $vdir, $whole);
protected function preparePackage() {
parent::preparePackage();
- $compiler = wsHTML5Compiler::factory($this->book_id, null, $this->os, $this->vdir);
- $compiler->compile();
+ if ($this->os == 'all') {
+ $oss = $this->supportedOS;
+ } else {
+ $oss = array($this->os);
+ }
- unlink($this->vdir . '/indext.html');
- unlink($this->vdir . '/indexu.html');
- unlink($this->vdir . '/widget.html');
- unlink($this->vdir . '/cache.appcache');
+ foreach ($oss as $os) {
+ $vdir = $this->vdir;
+ if (count($oss) > 1) {
+ $vdir.='/' . $os;
+ }
+ $compiler = wsHTML5Compiler::factory($this->book_id, null, $os, $vdir);
+ $compiler->compile();
- if ($this->makeResources) {
+ unlink($vdir . '/indext.html');
+ unlink($vdir . '/indexu.html');
+ unlink($vdir . '/widget.html');
+ unlink($vdir . '/cache.appcache');
- if ($this->os == 'ios') {
- $this->resources = $this->vdir . '/Resources';
- $this->makeIOSResources();
- } elseif ($this->os == 'android') {
- $this->resources = $this->vdir . '/Resources';
- $this->makeAndroidResources();
+
+ if ($this->makeResources) {
+ if ($this->os == 'ios') {
+ $this->resources = $vdir . '/Resources';
+ $this->makeIOSResources();
+ } elseif ($this->os == 'android') {
+ $this->resources = $vdir . '/Resources';
+ $this->makeAndroidResources();
+ }
}
}
}
'drawable-xhdpi' => 96
);
- $splashs = array('drawable' => 'x',
- 'drawable-hdpi' => 'x',
- 'drawable-ldpi' => 'x',
- 'drawable-mdpi' => 'x',
- 'drawable-xhdpi' => 'x');
+
+ $splashs = array('drawable' => '1024x768',
+ 'drawable-hdpi' => '1024x768',
+ 'drawable-ldpi' => '320x480',
+ 'drawable-mdpi' => '640x960',
+ 'drawable-xhdpi' => '1280x1920');
foreach ($icons as $dir => $size) {
$d = $this->resources . '/' . $dir;
if (!file_exists($d)) {
mkdir($d, 0777, true);
}
- $list($w, $h) = explode('x', $size);
- $this->_makeIcon($w, $h, 'splash', $d);
+
+ $this->_makeIcon($size, 'icon', $d);
}
foreach ($splashs as $dir => $size) {
if (!file_exists($d)) {
mkdir($d, 0777, true);
}
- $this->_makeSplash($size, 'splash', $d);
+ list($w, $h) = explode('x', $size);
+
+ if ($w > $h) {
+ $memo = $h;
+ $h = $w;
+ $w = $memo;
+ }
+
+ $this->_makeSplash($w, $h, 'splashportrait', $d);
+ $this->_makeSplash($h, $w, 'splashlandscape', $d);
}
}