Animatron/player — pull request #165 by shamansir (2014-03-21 14:36:14+00:00)
Title: Refactor the way player stores options and changes size.

Now, Sizing Rules are different, here's the short version of sizing priority order, see `doc/API.md/Sizing Rules` for detailed information:

* `setSize` method of player
* `force-scene-size` in URL or CANVAS or IFRAME, forces player to resize itself to a size of an animation
* `width`+`height`/`w`+`h` attrinbutes in URL of snapshot or IFRAME
* `width`+`height` properties in player's options object when creating
* `anm-width`+`anm-height` properties of CANVAS or IFRAME tag
* `width`+`height` properties of CANVAS or IFRAME
* browser-flow-defined size

Also, all _static_ options related to player itself are stored directly in player now, all _dynamic_ values which change while playing, like playing time, player condition, actual FPS & others are stored in `player.state`. All information related to animation itself (it's) is stored directly as `player.anim` properties now. `anim` object is completely removed from `options` object which was optionally allowed to be passed to player constructor or `createPlayer` function.

It's also possible to specify `mode`-related (`handleEvents`, `drawStill`, `controlsEnabled`, `infiniteDuration`, ...) options separately now.

New player options object:

```javascript
{ 'debug': false,
'repeat': false,
'autoPlay': false,
'mode': C.M_VIDEO,
'zoom': 1.0,
'speed': 1.0,
'width': undefined,
'height': undefined,
'bgColor': undefined,
'infiniteDuration': undefined, // undefined means 'auto'
'drawStill': undefined, // undefined means 'auto'
'audioEnabled': true,
'handleEvents': undefined, // undefined means 'auto'
'controlsEnabled': undefined, // undefined means 'auto'
'forceSceneSize': false,
'muteErrors': false
}
```

New player state:

```javascript
{ 'happens': C.NOTHING, // may be C.STOPPED, C.PLAYING, C.PAUSED, C.LOADING, C.RES_LOADING, C.ERROR
'time': Player.NO_TIME, // current time position
'from': 0, // requested time to play form
'stop': Player.NO_TIME, // requested time to pause at
'afps': 0, // actual FPS
'speed': 1, // current speed
'duration': undefined // duration of current animation
}
```