// Copyright 2014 Globo.com Player authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

var BaseObject = require('./base/base_object')
var CoreFactory = require('./components/core_factory')
var Loader = require('./components/loader')
var Mediator = require('./components/mediator')


class Player extends BaseObject {
  initialize(params) {
    window.p = this
    params.displayType || (params.displayType = 'pip')
    this.params = params
    this.loader = new Loader(this.params)
    this.coreFactory = new CoreFactory(this, this.loader)
  }

  attachTo(element) {
    this.params.parentElement = element
    this.core = this.coreFactory.create()
  }

  load(sources) {
    this.core.load(sources)
  }

  destroy() {
    this.core.destroy()
  }
}


global.DEBUG = false

window.WP3 = { Player: Player, Mediator: Mediator }

module.exports = window.WP3

@@ -822,16 +822,570 @@
 oy()%0A  %7D
+%0A%0A  play() %7B%0A    this.core.mediaControl.container.play();%0A  %7D%0A%0A  pause() %7B%0A    this.core.mediaControl.container.pause();%0A  %7D%0A%0A  stop() %7B%0A    this.core.mediaControl.container.stop();%0A  %7D%0A%0A  seek(time) %7B%0A    this.core.mediaControl.container.setCurrentTime(time);%0A  %7D%0A%0A  setVolume(volume) %7B%0A    this.core.mediaControl.container.volume(volume);%0A  %7D%0A%0A  mute() %7B%0A    this.core.mediaControl.container.volume(0);%0A  %7D%0A%0A  unmute() %7B%0A    this.core.mediaControl.container.volume(100);%0A  %7D%0A%0A  isPlaying() %7B%0A    return this.core.mediaControl.container.isPlaying();%0A  %7D
 %0A%7D%0A%0A%0Aglo

add playback handling functions interface