Skip to content

Commit

Permalink
Merge pull request #92 from cloudinary/CLD-12618-floating-player
Browse files Browse the repository at this point in the history
CLD-12618 Floating player improvements
  • Loading branch information
tsi authored Apr 23, 2019
2 parents 5abebee + a51e9a7 commit f2744b1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/assets/styles/components/title-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
height: 7.2em;
text-align: left;
padding: 16px 21px;
pointer-events: none;

.vjs-title-bar-title {
width: 100%;
Expand Down Expand Up @@ -64,4 +65,3 @@
.vjs-has-started.vjs-no-flex .vjs-title-bar {
display: table;
}

9 changes: 9 additions & 0 deletions src/plugins/floating-player/floating-player.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
cursor: pointer;
}

.vjs-time-control,
.vjs-upcoming-video-title-display,
.vjs-recommendations-overlay {
display: none;
}
.vjs-upcoming-video .vjs-upcoming-video-bar {
background-color: transparent;
}

&.cld-video-player-floater-bottom-right {
bottom: 20px !important;
right: 20px !important;
Expand Down
7 changes: 5 additions & 2 deletions src/plugins/floating-player/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const defaults = {
class FloatingPlayer {
constructor(player, opts = {}) {
opts = assign({}, defaults, opts);
// Handle non left-right values.
if (opts.floatTo && opts.floatTo !== 'left' && opts.floatTo !== 'right') {
opts.floatTo = defaults.floatTo;
}

this.player = player;
let _options = sliceProperties(opts, 'fraction');
Expand Down Expand Up @@ -41,7 +45,6 @@ class FloatingPlayer {
};

const addWindowEventHandlers = () => {
console.log('ADDING');
window.addEventListener('DOMContentLoaded', checkViewportState, false);
window.addEventListener('load', checkViewportState, false);
window.addEventListener('scroll', checkViewportState, false);
Expand All @@ -51,7 +54,7 @@ class FloatingPlayer {
const registerEventHandlers = () => {
this.player.on('play', checkViewportState);
this.player.on('play', addWindowEventHandlers);
this.player.on('pause', removeWindowEventHandlers);
// this.player.on('pause', removeWindowEventHandlers);
this.player.on('dispose', removeWindowEventHandlers);
};

Expand Down

0 comments on commit f2744b1

Please sign in to comment.