Skip to content

Commit

Permalink
fix baseDir
Browse files Browse the repository at this point in the history
  • Loading branch information
hustKiwi committed May 13, 2015
1 parent b2e4712 commit 926c395
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 38 deletions.
16 changes: 5 additions & 11 deletions dist/player.js
Expand Up @@ -21,7 +21,6 @@
namespace: root._mu,
version: '1.0.0',
timerResolution: 25,
cdn: 'http://apps.bdimg.com/libs/muplayer/',
engine: {
TYPES: {
FLASH_MP3: 'FlashMP3Core',
Expand Down Expand Up @@ -2396,7 +2395,7 @@ var slice = [].slice;
instance = null;

Player.defaults = {
baseDir: "" + cfg.cdn + cfg.version,
baseDir: 'http://mu5.bdstatic.com/cms/muplayer/1-0-0/',
mode: 'loop',
mute: false,
volume: 80,
Expand Down Expand Up @@ -2474,20 +2473,15 @@ var slice = [].slice;
*/

function Player(options) {
var baseDir, opts;
var baseDir, opts, singleton;
this.opts = opts = $.extend({}, Player.defaults, options);
this.waitingTimer = new Timer(100);
this._checkFrozen(['play', 'pause', 'stop', 'next', 'prev', 'retry', 'replay', 'setVolume', 'setMute', 'setUrl', 'setCurrentPosition', '_startWaitingTimer']);
baseDir = opts.baseDir;
if (baseDir === false) {
baseDir = '';
} else if (!baseDir) {
throw new Error("baseDir must be set! Usually, it should point to the MuPlayer's dist directory.");
}
if (baseDir && !baseDir.endsWith('/')) {
baseDir = opts.baseDir, singleton = opts.singleton;
if (!baseDir.endsWith('/')) {
baseDir = baseDir + '/';
}
if (opts.singleton) {
if (singleton) {
if (instance) {
return instance;
}
Expand Down
4 changes: 2 additions & 2 deletions dist/player.min.js

Large diffs are not rendered by default.

16 changes: 5 additions & 11 deletions dist/zepto-player.js
Expand Up @@ -71,7 +71,6 @@
namespace: root._mu,
version: '1.0.0',
timerResolution: 25,
cdn: 'http://apps.bdimg.com/libs/muplayer/',
engine: {
TYPES: {
FLASH_MP3: 'FlashMP3Core',
Expand Down Expand Up @@ -1818,7 +1817,7 @@ var slice = [].slice;
instance = null;

Player.defaults = {
baseDir: "" + cfg.cdn + cfg.version,
baseDir: 'http://mu5.bdstatic.com/cms/muplayer/1-0-0/',
mode: 'loop',
mute: false,
volume: 80,
Expand Down Expand Up @@ -1896,20 +1895,15 @@ var slice = [].slice;
*/

function Player(options) {
var baseDir, opts;
var baseDir, opts, singleton;
this.opts = opts = $.extend({}, Player.defaults, options);
this.waitingTimer = new Timer(100);
this._checkFrozen(['play', 'pause', 'stop', 'next', 'prev', 'retry', 'replay', 'setVolume', 'setMute', 'setUrl', 'setCurrentPosition', '_startWaitingTimer']);
baseDir = opts.baseDir;
if (baseDir === false) {
baseDir = '';
} else if (!baseDir) {
throw new Error("baseDir must be set! Usually, it should point to the MuPlayer's dist directory.");
}
if (baseDir && !baseDir.endsWith('/')) {
baseDir = opts.baseDir, singleton = opts.singleton;
if (!baseDir.endsWith('/')) {
baseDir = baseDir + '/';
}
if (opts.singleton) {
if (singleton) {
if (instance) {
return instance;
}
Expand Down
4 changes: 2 additions & 2 deletions dist/zepto-player.min.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/js/core/cfg.coffee
Expand Up @@ -9,8 +9,6 @@ do (root = @, factory = ->
# 这个不经测试调优就尽量不要改, 会影响部分统计数据和性能。
timerResolution: 25

cdn: 'http://apps.bdimg.com/libs/muplayer/'

engine:
TYPES:
FLASH_MP3: 'FlashMP3Core'
Expand Down
16 changes: 6 additions & 10 deletions src/js/player.coffee
Expand Up @@ -36,7 +36,7 @@ do (root = this, factory = (
instance = null

@defaults:
baseDir: "#{cfg.cdn}#{cfg.version}"
baseDir: 'http://mu5.bdstatic.com/cms/muplayer/1-0-0/'
mode: 'loop'
mute: false
volume: 80
Expand Down Expand Up @@ -121,17 +121,13 @@ do (root = this, factory = (
'setCurrentPosition', '_startWaitingTimer'
])

baseDir = opts.baseDir
if baseDir is false
baseDir = ''
else unless baseDir
throw new Error "baseDir must be set! Usually, it should point to the MuPlayer's dist directory."
if baseDir and not baseDir.endsWith('/')
{ baseDir, singleton } = opts

unless baseDir.endsWith('/')
baseDir = baseDir + '/'

if opts.singleton
if instance
return instance
if singleton
return instance if instance
instance = @

@playlist = new Playlist(absoluteUrl: opts.absoluteUrl)
Expand Down

0 comments on commit 926c395

Please sign in to comment.