Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Fix videoplayback on NC15 #68

Merged
merged 3 commits into from
Nov 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 13 additions & 3 deletions js/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@ var videoViewer = {
return $.when();
} else {
this.videoJSLoaded = true;
var stylePath = OC.filePath('files_videoplayer', 'videojs', 'src/video-js.css');
var stylePath = OC.filePath('files_videoplayer', 'js', 'videojs/video-js.css');
$('head').append($('<link rel="stylesheet" type="text/css" href="' + stylePath + '"/>'));
var scriptPath = OC.filePath('files_videoplayer', 'videojs', 'src/video.js');
return $.getScript(scriptPath, function (xhr) {eval(xhr);});
var scriptPath = OC.filePath('files_videoplayer', 'js', 'videojs/video.js');

var deferred = $.Deferred();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is duplicating https://github.com/nextcloud/server/blob/b7767a51f140d3f588278f053f3a9e1eb84e4346/core/js/js.js#L364-L385, isn't it? Does $.getScript load the script differently?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I have no idea why or how but it is different. With $.getScript I did not have a videojs funtion after loading. This way i do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChristophWurst but it probably would make sense to look into a generic approach here indeed. This is just the quick fix for 15.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, they are indeed a bit different. Let's use this fix for 15 now and look into a proper npm setup for 16 where we can use dependabot and video.js from https://www.npmjs.com/package/video.js.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could integrate that with the slideshow/big picture we discussed in nextcloud/server#12382

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sounds good. So let's npm'ize this repo for 16, switch to Vue and use a standardized component for the overlay.

var script = document.createElement('script');
script.src = scriptPath;
script.setAttribute('nonce', btoa(OC.requestToken));
script.onload = function() {
deferred.resolve();
};
document.head.appendChild(script);

return deferred;
}
},
videoJSLoaded: false,
Expand Down