Skip to content

Commit

Permalink
Fix resizer (lynckia#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun authored Jul 13, 2017
1 parent 714178d commit b39d04d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
4 changes: 3 additions & 1 deletion erizo_controller/erizoClient/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ targets.forEach(

gulp.task('lint', () => {
return gulp.src(config.paths.js)
.pipe(plugins.eslint());
.pipe(plugins.eslint())
.pipe(plugins.eslint.format())
.pipe(plugins.eslint.failAfterError());
});

gulp.task('watch', () => {
Expand Down
6 changes: 4 additions & 2 deletions erizo_controller/erizoClient/src/Erizo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { LicodeEvent, RoomEvent, StreamEvent } from './Events';
import Stream from './Stream';
import Logger from './utils/Logger';

require("expose-loader?adapter!../lib/adapter.js");
require("script-loader!./utils/L.Resizer.js");
// eslint-disable-next-line
require('expose-loader?adapter!../lib/adapter.js');
// eslint-disable-next-line
require('script-loader!./utils/L.Resizer.js');


const Erizo = {
Expand Down
2 changes: 1 addition & 1 deletion erizo_controller/erizoClient/src/ErizoFc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Erizo = {
LicodeEvent,
RoomEvent,
StreamEvent,
Stream
Stream,
};

export default Erizo;
24 changes: 12 additions & 12 deletions erizo_controller/erizoClient/src/utils/L.Resizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,6 @@ if (window.addEventListener) {
window.attachEvent('onload', init);
}

// Only used for the dirty checking, so the event callback count is limted
// to max 1 call per fps per sensor.
// In combination with the event based resize sensor this saves cpu time,
// because the sensor is too fast and
// would generate too many unnecessary events.
const customRequestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
function delay(fn) {
return window.setTimeout(fn, 20);
};

/**
* Iterate over each of the provided element(s).
*
Expand Down Expand Up @@ -347,6 +335,18 @@ L.ResizeSensor = function ResizeSensor(element, callback = () => {}) {
* @param {Function} resized
*/
function attachResizeEvent(htmlElement, resized) {
// Only used for the dirty checking, so the event callback count is limted
// to max 1 call per fps per sensor.
// In combination with the event based resize sensor this saves cpu time,
// because the sensor is too fast and
// would generate too many unnecessary events.
const customRequestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
function delay(fn) {
return window.setTimeout(fn, 20);
};

const newElement = htmlElement;
if (!newElement.resizedAttached) {
newElement.resizedAttached = new EventQueue();
Expand Down
6 changes: 3 additions & 3 deletions erizo_controller/erizoClient/src/views/VideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ const VideoPlayer = (spec) => {
// It will stop the VideoPlayer and remove it from the HTML
that.destroy = () => {
that.video.pause();
delete that.Loggerr;
delete that.resizer;
that.parentNode.removeChild(that.div);
};

that.Logger = () => {
that.resize = () => {
const width = that.container.offsetWidth;
const height = that.container.offsetHeight;

Expand Down Expand Up @@ -132,7 +132,7 @@ const VideoPlayer = (spec) => {
if (spec.options.resizer !== false) {
that.resizer = L.ResizeSensor(that.container, that.resize);

that.Logger();
that.resize();
}

// Bottom Bar
Expand Down

0 comments on commit b39d04d

Please sign in to comment.