|
'use strict' |
|
|
|
var Promise = require('korbutJS/src/Promise').Promise |
|
var klass = require('korbutJS/src/ZView').class |
|
var ZView = require('korbutJS/src/ZView').ZView |
|
var Transition = require('korbutJS/src/Transition').Transition |
|
var ClientRect = require('korbutJS/src/ClientRect').ClientRect |
|
var requestAnimationFrame = require("korbutJS/src/dom-utils/requestAnimationFrame").requestAnimationFrame |
|
|
|
var _ = require('./utils') |
|
|
|
var eventBus = new (require('./SEventBus').SEventBus) |
|
|
|
var YTAPI = require('../globals').YTAPI |
|
|
|
var Button = ZView.extend(function(statics) { |
|
return { |
|
constructor: function(locales) { |
|
ZView.apply(this, arguments) |
|
|
|
this.query('button').addEventListener('click', this._clickhandler = function() { |
|
this.dispatchEvent('click') |
|
}.bind(this)) |
|
} |
|
, _template: 'button@button>span{$text}' |
|
, kill: { enumerable: true, |
|
value: function() { |
|
this.query('button').removeEventListener('click', this._clickhandler) |
|
this.purge(true) |
|
} |
|
} |
|
} |
|
}) |
|
|
|
var Timeline = ZView.extend(function(statics) { |
|
return { |
|
constructor: function() { |
|
ZView.apply(this, arguments) |
|
} |
|
, _template: '.rt_video_player__progress' |
|
, update: { enumerable: true, |
|
value: function(v) { |
|
this.root.style.width = v+"%" |
|
} |
|
} |
|
, kill: { enumerable: true, |
|
value: function() { |
|
this.purge(true) |
|
} |
|
} |
|
} |
|
}) |
|
|
|
var Overlay = ZView.extend(function(statics) { |
|
return { |
|
constructor: function() { |
|
ZView.apply(this, arguments) |
|
|
|
this.transition = new Transition(this.root, {opacity: '800ms ease-out'}) |
|
} |
|
, _template: '.rt_video_overlay' |
|
, hide: { enumerable: true, |
|
value: function() { |
|
return this.transition.animate({opacity: 0}).then(function() { |
|
return new Promise(function(resolve) { |
|
requestAnimationFrame(function() { |
|
resolve() |
|
}) |
|
}) |
|
}) |
|
} |
|
} |
|
, kill: { enumerable:true, |
|
value: function() { |
|
// purge transition |
|
this.transition.purge() |
|
this.purge(true) |
|
} |
|
} |
|
} |
|
}) |
|
|
|
module.exports.YTPlayerZView = ZView.extend(function(statics) { |
|
statics._NOT_STARTED = -1 |
|
statics._ENDED = 0 |
|
statics._PLAYING = 1 |
|
statics._PAUSED = 2 |
|
statics._BUFFERING = 3 |
|
statics._CUED = 5 |
|
|
|
return { |
|
constructor: function(locales) { |
|
if (typeof locales.videoId == 'undefined') return new Error('Video: Id not given') |
|
|
|
ZView.apply(this, arguments) |
|
|
|
this.addEventListener('player:state-changed', this._onstatechangedhandler = function(e, YTE) { |
|
YTE = e.detail.YTEvent |
|
|
|
if (YTE.data == module.exports.YTPlayerZView._ENDED) { |
|
eventBus.dispatchEvent('video:has-ended', {id: this.uid}) |
|
} |
|
|
|
if (YTE.data == module.exports.YTPlayerZView._NOT_STARTED) { |
|
eventBus.dispatchEvent('video:has-started', {id: this.uid}) |
|
} |
|
|
|
if (YTE.data == module.exports.YTPlayerZView._PAUSE) { |
|
eventBus.dispatchEvent('video:is-paused', {id: this.uid}) |
|
} |
|
|
|
if (YTE.data == module.exports.YTPlayerZView._PLAYING) { |
|
eventBus.dispatchEvent('video:is-playing', {id: this.uid}) |
|
} |
|
|
|
if (YTE.data == module.exports.YTPlayerZView._NOT_STARTED || YTE.data == module.exports.YTPlayerZView._ENDED || YTE.data == module.exports.YTPlayerZView._PAUSED) { |
|
this.isPlaying = false |
|
} else if (YTE.data == module.exports.YTPlayerZView._PLAYING) { |
|
this.isPlaying = true |
|
} |
|
}.bind(this)) |
|
|
|
if (!locales.height) this.model.setItem('height', 390) |
|
if (!locales.width) this.model.setItem('width', 640) |
|
|
|
// add readyness |
|
this.ready = new Promise(function(resolve, reject) { |
|
// check if API is loaded |
|
YTAPI.load().then(function(YT) { |
|
// on player:ready, resolve ready promise |
|
this.addEventListener('player:ready', this._onreadyhandler = function() { resolve() }) |
|
// instantiate player |
|
this._YTPLAYER = new YT.Player(this.root, { |
|
height: this.model.getItem('height') |
|
, width: this.model.getItem('width') |
|
, videoId: locales.videoId |
|
, playerVars: locales.playerVars||{} |
|
, events: { |
|
'onReady': this._playerReady.bind(this), |
|
'onStateChange': this._stateChanged.bind(this) |
|
} |
|
}) |
|
}.bind(this)) |
|
}.bind(this)) |
|
} |
|
, _template: '.rt_video_player' |
|
, isPlaying: {enumerable: true, |
|
get: function() { |
|
return this._isPlaying || (this._isPlaying = false) |
|
} |
|
, set: function(v) { |
|
this._isPlaying = v |
|
} |
|
} |
|
, isMuted: { enumerable: true, |
|
get: function() { |
|
return this._isMuted |
|
} |
|
, set: function(v) { |
|
if (v && this._isMuted != v) |
|
this._isMuted = v, this._YTPLAYER.mute() |
|
else if (!v && this._isMuted != v) |
|
this._isMuted = v, this._YTPLAYER.unMute() |
|
} |
|
} |
|
, currentTime: { enumerable: true, |
|
get: function(currTime) { |
|
currTime = this.currentTime = this._YTPLAYER.getCurrentTime() |
|
return currTime |
|
} |
|
, set: function(v) { |
|
this._currentTime = v |
|
} |
|
} |
|
, duration: { enumerable: true |
|
, get: function() { |
|
return this._duration || (this._duration = this._YTPLAYER.getDuration()) |
|
} |
|
} |
|
, volume: { enumerable: true |
|
, get: function() { |
|
return this._YTPLAYER.getVolume(v) |
|
} |
|
, set: function(v) { |
|
return this._YTPLAYER.setVolume(v) |
|
} |
|
} |
|
, _playerReady: { enumerable: true, |
|
value: function(e) { |
|
this.dispatchEvent('player:ready', {YTEvent:e}) |
|
} |
|
} |
|
, _stateChanged: { enumerable: true, |
|
value: function(e) { |
|
this.dispatchEvent('player:state-changed', {YTEvent:e}) |
|
} |
|
} |
|
, play: { enumerable: true, |
|
value: function() { |
|
this._YTPLAYER.playVideo() |
|
} |
|
} |
|
, pause: { enumerable: true, |
|
value: function() { |
|
this._YTPLAYER.pauseVideo() |
|
} |
|
} |
|
, stop: { enumerable: true, |
|
value: function() { |
|
this._YTPLAYER.stopVideo() |
|
} |
|
} |
|
, seek: { enumerable: true, |
|
value: function(percent, seekAheadBool) { |
|
this._YTPLAYER.seekTo(this.duration*percent, seekAheadBool||false) |
|
} |
|
} |
|
, fullscreen: { enumerable: true, |
|
value: function(bool) { |
|
var i, w, h |
|
|
|
i = this._YTPLAYER.getIframe() |
|
|
|
if (bool) { |
|
i.width = '100%' |
|
i.height = '100%' |
|
} else { |
|
i.width = this.model.getItem('width') |
|
i.height = this.model.getItem('height') |
|
} |
|
} |
|
} |
|
, kill: { enumerable: true, |
|
value: function() { |
|
this.purge(true) |
|
} |
|
} |
|
} |
|
}) |
|
|
|
module.exports.PosterFrameZView = ZView.extend(function(statics) { |
|
statics._CLASS_VISIBLE = ' rt_video_poster--visible' |
|
statics._HIDDEN = {opacity:0} |
|
statics._VISIBLE = {opacity:1} |
|
|
|
return { |
|
constructor: function(locales) { |
|
ZView.apply(this, arguments) |
|
this.transition = new Transition(this.root, {opacity: '800ms ease-out'}) |
|
this.root.addEventListener('click', this._clickhandler = function() { |
|
eventBus.dispatchEvent('video:start', {id: this.model.getItem('videoID')}) |
|
}.bind(this)) |
|
|
|
this._visibility = false |
|
} |
|
, _template: '.rt_video_poster>figure.rt_video_poster__figure>img.rt_video_poster__img[src=$src][alt=]' |
|
, visibility: { enumerable: true, |
|
get: function() { |
|
return this._visibility |
|
} |
|
} |
|
, show: { enumerable: true, |
|
value: function(p) { |
|
return this.transition.animate( module.exports.VideoControlsZView._VISIBLE ).then(function() { |
|
this.root.className += module.exports.PosterFrameZView._CLASS_VISIBLE |
|
this._visibility = true |
|
return new Promise(function(resolve) { |
|
requestAnimationFrame(function() { resolve() }) |
|
}) |
|
}.bind(this)) |
|
} |
|
} |
|
, hide: { enumerable: true, |
|
value: function(p) { |
|
return this.transition.animate( module.exports.VideoControlsZView._HIDDEN ).then(function() { |
|
this._visibility = false |
|
this.root.className = this.root.className.replace(module.exports.PosterFrameZView._CLASS_VISIBLE, '') |
|
return new Promise(function(resolve) { |
|
requestAnimationFrame(function() { resolve() }) |
|
}) |
|
}.bind(this)) |
|
} |
|
} |
|
, kill: { enumerable: true, |
|
value: function() { |
|
this.root.removeEventListener('click', this._clickhandler) |
|
// purge transition |
|
this.transition.purge() |
|
this.purge(true) |
|
} |
|
} |
|
} |
|
}) |
|
|
|
module.exports.VideoControlsZView = ZView.extend(function(statics) { |
|
statics._CLASS_VISIBLE = ' rt_video_controls--visible' |
|
statics._CLASS_ACTIVE = ' rt_video_controls--active' |
|
statics._CLASS_PAUSE = ' rt_video_controls__play--pause' |
|
statics._CLASS_UNMUTE = ' rt_video_controls__mute--unmute' |
|
statics._CLASS_ENTERFS = ' rt_video_controls__mute--enter-fullscreen' |
|
statics._TIMER_MS = 2000 |
|
statics._HIDDEN = {opacity:0} |
|
statics._VISIBLE = {opacity:1} |
|
|
|
function setTimer() { |
|
this._visibilityTimer = setTimeout(function() { |
|
this.setVisibility(false) |
|
}.bind(this), module.exports.VideoControlsZView._TIMER_MS) |
|
} |
|
|
|
return { |
|
constructor: function(locales) { |
|
ZView.apply(this, arguments) |
|
|
|
this.transition = new Transition(this.root, {opacity: '.4s ease-out'}) |
|
|
|
// define button |
|
this.togglePlayButton = new Button({text: this.model.getItem('play')}) |
|
this.toggleSoundButton = new Button({text: this.model.getItem('mute')}) |
|
this.stopButton = new Button({text: this.model.getItem('stop')}) |
|
this.fsButton = new Button({text: this.model.getItem('fullscreen')}) |
|
this.timeline = new Timeline |
|
|
|
this.fsButton.addEventListener('click', function() { |
|
eventBus.dispatchEvent('video:fullscreen-'+this.fsButton.model.getItem('action'), {id: this.model.getItem('videoID')}) |
|
}.bind(this)) |
|
|
|
this.togglePlayButton.addEventListener('click', function() { |
|
eventBus.dispatchEvent('video:'+this.togglePlayButton.model.getItem('action'), {id: this.model.getItem('videoID')}) |
|
}.bind(this)) |
|
|
|
this.toggleSoundButton.addEventListener('click', function() { |
|
eventBus.dispatchEvent('video:'+this.toggleSoundButton.model.getItem('action'), {id: this.model.getItem('videoID')}) |
|
}.bind(this)) |
|
|
|
this.stopButton.addEventListener('click', function() { |
|
eventBus.dispatchEvent('video:stop', {id: this.model.getItem('videoID')}) |
|
}.bind(this)) |
|
|
|
this.query('timeline').addEventListener('click', this._timelinehandler = function(e, cR) { |
|
cR = new ClientRect({node: this.query('timeline')}) |
|
cR.compute(e, function(err, matrix) { |
|
eventBus.dispatchEvent('video:seek', {id: this.model.getItem('videoID'), time: Math.abs(matrix.W.x)/matrix.width}) |
|
}.bind(this)) |
|
}.bind(this)) |
|
|
|
this.root.addEventListener('click', this._wholeclickhandler = function(e) { |
|
if (e.target == this.root) { |
|
eventBus.dispatchEvent('video:'+this.togglePlayButton.model.getItem('action'), {id: this.model.getItem('videoID')}) |
|
} |
|
}.bind(this)) |
|
|
|
this.root.addEventListener('mousemove', this._mousemovehandler = function() { |
|
clearTimeout(this._visibilityTimer||null) |
|
clearTimeout(this._moveTimer||null) |
|
if (!this.visibility && this.active && !this._keepoverlay) { |
|
this.setVisibility(true) |
|
} else if (this.active && !this._keepoverlay) { |
|
this._moveTimer = setTimeout(function() { |
|
setTimer.call(this) |
|
}.bind(this), 500) |
|
} |
|
}.bind(this)) |
|
|
|
jQuery(this.query('controlwrapper')).on('mouseenter, mouseover', 'button', this._buttonenterhandler = function() { |
|
this._keepoverlay = true |
|
}.bind(this)) |
|
|
|
jQuery(this.query('controlwrapper')).on('mouseleave', 'button', this._buttonleavehandler = function() { |
|
this._keepoverlay = false |
|
}.bind(this)) |
|
|
|
this.query('controlwrapper').addEventListener('click', this._wholeclickhandlercontrols = function(e) { |
|
if (e.target == this.query('controlwrapper')) { |
|
eventBus.dispatchEvent('video:'+this.togglePlayButton.model.getItem('action'), {id: this.model.getItem('videoID')}) |
|
} |
|
}.bind(this)) |
|
|
|
this.root.addEventListener('mouseenter', this._mouseenterhandler = function() { |
|
if (!this.visibility && this.active) { |
|
clearTimeout(this._visibilityTimer||null) |
|
clearTimeout(this._moveTimer||null) |
|
this.setVisibility(true) |
|
} |
|
}.bind(this)) |
|
|
|
this.root.addEventListener('mouseleave', this._mouseouthandler = function() { |
|
if (this.visibility && this.active) { |
|
clearTimeout(this._visibilityTimer||null) |
|
clearTimeout(this._moveTimer||null) |
|
this.setVisibility(false) |
|
} |
|
}.bind(this)) |
|
|
|
this.togglePlay(true) |
|
this.toggleFS(true) |
|
this._keepoverlay = false |
|
this.setVisibility(false) |
|
this.setActive(false) |
|
|
|
// append buttons |
|
this.query('togglePlayButton').appendChild(this.togglePlayButton.root) |
|
this.query('toggleSoundButton').appendChild(this.toggleSoundButton.root) |
|
this.query('stopButton').appendChild(this.stopButton.root) |
|
this.query('fsButton').appendChild(this.fsButton.root) |
|
this.query('timeline').appendChild(this.timeline.root) |
|
} |
|
, _template: '.rt_video_controls@controls>\ |
|
(.rt_video_controls__wrapper@controlwrapper > \ |
|
.rt_video_controls__button-container@togglePlayButton\ |
|
+ .rt_video_controls__button-container@toggleSoundButton\ |
|
+ .rt_video_controls__button-container@fsButton\ |
|
+ .rt_video_controls__button-container@stopButton)\ |
|
+ (div.rt_video_player__timeline@timeline)' |
|
, active: { enumerable: true, |
|
get: function() { |
|
return this._active || (this._active = false) |
|
} |
|
} |
|
, visibility: { enumerable: true, |
|
get: function() { |
|
return this._visibility || null |
|
} |
|
} |
|
, setActive: { enumerable: true, |
|
value: function(v, v2) { |
|
this._active = v |
|
|
|
if (v) { |
|
this.root.className += module.exports.VideoControlsZView._CLASS_ACTIVE |
|
if (!v2) |
|
return this.setVisibility(true) |
|
else |
|
return new Promise(function(resolve) {resolve()}) |
|
} else { |
|
this.root.className = this.root.className.replace(module.exports.VideoControlsZView._CLASS_ACTIVE, '') |
|
return this.setVisibility(false) |
|
} |
|
} |
|
} |
|
, setVisibility: { enumerable: true, |
|
value: function(v) { |
|
if (v) |
|
return this.show() |
|
else |
|
return this.hide() |
|
} |
|
} |
|
, togglePlay: { enumerable: true, |
|
value: function(playBool, button) { |
|
button = this.togglePlayButton |
|
if (playBool) { |
|
button.model.setItem('action','play') |
|
button.model.setItem('text', this.model.getItem('play')) |
|
button.query("button").className = |
|
button.query("button").className.replace(module.exports.VideoControlsZView._CLASS_PAUSE,'') |
|
} else { |
|
button.model.setItem('action','pause') |
|
button.model.setItem('text', this.model.getItem('pause')) |
|
button.query("button").className += module.exports.VideoControlsZView._CLASS_PAUSE |
|
} |
|
} |
|
} |
|
, toggleFS: { enumerable: true, |
|
value: function(playBool, button) { |
|
button = this.fsButton |
|
if (playBool) { |
|
button.model.setItem('action','enter') |
|
button.model.setItem('text', this.model.getItem('enter-fs')) |
|
button.query("button").className = |
|
button.query("button").className.replace(module.exports.VideoControlsZView._CLASS_ENTERFS,'') |
|
} else { |
|
button.model.setItem('action','exit') |
|
button.model.setItem('text', this.model.getItem('exit-fs')) |
|
button.query("button").className += module.exports.VideoControlsZView._CLASS_ENTERFS |
|
} |
|
} |
|
} |
|
, toggleSound: { enumerable: true, |
|
value: function(soundBool, button) { |
|
button = this.toggleSoundButton |
|
if (soundBool) { |
|
button.model.setItem('action','mute') |
|
button.model.setItem('text', this.model.getItem('mute')) |
|
button.query("button").className = |
|
button.query("button").className.replace(module.exports.VideoControlsZView._CLASS_UNMUTE,'') |
|
} else { |
|
button.model.setItem('action','unmute') |
|
button.model.setItem('text', this.model.getItem('unmute')) |
|
button.query("button").className += module.exports.VideoControlsZView._CLASS_UNMUTE |
|
} |
|
} |
|
} |
|
, update: { enumerable: true, |
|
value: function(time, durr) { |
|
this.timeline.update((time/durr)*100) |
|
} |
|
} |
|
, show: { enumerable: true, |
|
value: function() { |
|
this.root.className += module.exports.VideoControlsZView._CLASS_VISIBLE |
|
this._visibility = true |
|
return this.transition.animate( module.exports.VideoControlsZView._VISIBLE ).then(function() { |
|
setTimer.call(this) |
|
return new Promise(function(resolve) { |
|
requestAnimationFrame(function() { resolve() }) |
|
}) |
|
}.bind(this)) |
|
} |
|
} |
|
, hide: { enumerable: true, |
|
value: function() { |
|
if (this._visibility) |
|
return this.transition.animate( module.exports.VideoControlsZView._HIDDEN ).then(function() { |
|
this.root.className = this.root.className.replace(module.exports.VideoControlsZView._CLASS_VISIBLE, '') |
|
this._visibility = false |
|
return new Promise(function(resolve) { |
|
requestAnimationFrame(function() { resolve() }) |
|
}) |
|
}.bind(this)) |
|
else return new Promise(function(resolve) {resolve()}) |
|
} |
|
} |
|
, kill: { enumerable: true, |
|
value: function() { |
|
this.root.removeEventListener('mousemove', this._mousemovehandler) |
|
this.root.removeEventListener('mouseenter', this._mousemovehandler) |
|
this.root.removeEventListener('mouseout', this._mousemovehandler) |
|
this.root.removeEventListener('click', this._wholeclickhandler) |
|
this.query('timeline').removeEventListener('click', this._timelinehandler) |
|
this.query('controlwrapper').addEventListener('click', this._wholeclickhandlercontrols) |
|
// THESE TWO JQUERY EVENTS |
|
jQuery(this.query('controlwrapper')).off('mouseenter, mouseover', 'button', this._buttonenterhandler) |
|
jQuery(this.query('controlwrapper')).off('mouseleave', 'button', this._buttonleavehandler) |
|
// kill sub views |
|
this.timeline.kill() |
|
this.togglePlayButton.kill() |
|
this.toggleSoundButton.kill() |
|
this.stopButton.kill() |
|
// purge transition |
|
this.transition.purge() |
|
// purge view |
|
this.purge(true) |
|
} |
|
} |
|
} |
|
}) |
|
|
|
module.exports.YTVideoContainerZView = ZView.extend(function(statics) { |
|
statics._READY_CLASS = ' rt_video_container--ready' |
|
statics._FS_CLASS = ' rt_video_container--fs' |
|
|
|
return { |
|
constructor: function(locales, player, controls, poster) { |
|
ZView.apply(this, arguments) |
|
|
|
this.player = player |
|
|
|
this.overlay = new Overlay |
|
|
|
player.ready.then(function() { |
|
if (typeof controls == 'object') { |
|
// set the toggleSound as the right value |
|
if (player.isMuted) { |
|
controls.toggleSound(false) |
|
} else { |
|
controls.toggleSound(true) |
|
} |
|
|
|
player.addEventListener('player:state-changed', this._onstatechangedhandler = function(e, YTE) { |
|
YTE = e.detail.YTEvent |
|
// if player hasn't started, has ended, or is paused |
|
if (YTE.data == module.exports.YTPlayerZView._NOT_STARTED || YTE.data == module.exports.YTPlayerZView._ENDED || YTE.data == module.exports.YTPlayerZView._PAUSED) { |
|
// switch togglePlay button text |
|
controls.togglePlay(true) |
|
// clear setTimeout |
|
clearTimeout(this._controlsUpdateSTO||null); |
|
} else if (YTE.data == module.exports.YTPlayerZView._PLAYING) { |
|
// set right text for togglePlay |
|
controls.togglePlay(false) |
|
// STO every 500ms to get the actual time of the video, will update approx every seconds. |
|
this._controlsUpdateSTO = setTimeout(function upd() { |
|
// update controls timeline |
|
controls.update(player.currentTime, player.duration) |
|
this._controlsUpdateSTO = setTimeout(upd.bind(this)) |
|
}.bind(this), 500) |
|
} |
|
}.bind(this)) |
|
} |
|
|
|
if (typeof controls == 'object') { |
|
this.controls = controls |
|
this.root.appendChild(controls.root) |
|
} |
|
|
|
this.overlay.hide() |
|
// in waiting for a fix on Transition :) |
|
setTimeout(function() { |
|
this.overlay.kill() |
|
}.bind(this), 800) |
|
|
|
this.root.className += ' '+module.exports.YTVideoContainerZView._READY_CLASS |
|
}.bind(this)) |
|
|
|
this.root.appendChild(this.overlay.root) |
|
|
|
if (typeof poster == 'object') { |
|
this.poster = poster |
|
this.root.appendChild(poster.root) |
|
} |
|
|
|
this.root.appendChild(player.root) |
|
} |
|
, _template: '.rt_video_container' |
|
, toggle: { enumerable: true, |
|
value: function(boolControls, boolVisibileControls) { |
|
if (boolControls) { |
|
if (typeof this.poster != "undefined") { |
|
return this.poster.hide().then(function() { |
|
if (typeof this.controls != "undefined") |
|
return this.controls.setActive(true, !!boolVisibileControls) |
|
}.bind(this)) |
|
} else if (typeof this.controls != "undefined") { |
|
return this.controls.setActive(true, !!boolVisibileControls) |
|
} |
|
} else { |
|
if (typeof this.controls != 'undefined') { |
|
return this.controls.setActive(false).then(function() { |
|
if (typeof this.poster != "undefined") { |
|
return this.poster.show() |
|
} |
|
}.bind(this)) |
|
} else if (typeof this.poster != "undefined") { |
|
return this.poster.show() |
|
} |
|
} |
|
} |
|
} |
|
, fullscreen: { enumerable: true, |
|
get: function() { |
|
return this._fullscreen || (this._fullscreen = false) |
|
} |
|
, set: function(v, element) { |
|
element = element||this.root |
|
|
|
if (v) { |
|
this.savedScroll = window.pageYOffset || window.scrollY || document.documentElement.scrollTop || document.body.scrollTop || 0 |
|
_.requestFullscreen(element) |
|
} else { |
|
_.exitFullscreen() |
|
} |
|
} |
|
} |
|
, kill: { enumerable: true, |
|
value: function() { |
|
this.player.kill() |
|
|
|
if (typeof this.controls != 'undefined') |
|
this.controls.kill() |
|
if (typeof this.poster != 'undefined') |
|
this.poster.kill() |
|
|
|
this.purge(true) |
|
} |
|
} |
|
} |
|
}) |