files_videoplayer icon indicating copy to clipboard operation
files_videoplayer copied to clipboard

Chrome cannot play .mov files if type label is wrong.

Open Teifun2 opened this issue 6 years ago • 2 comments

Expected behaviour

The Chrome browser can play certain .mov files if they are not embedded with the "video/quicktime" tag.

Actual behaviour

The video player automatically chooses the type tag from the MIME type of the file, such that the video cannot be played.

Steps to reproduce

The whole error with example is also explained in the following Bug report: https://secure.phabricator.com/T13135

Teifun2 avatar Apr 29 '19 12:04 Teifun2

I was just playing around in my browser and changing the local java script to see if i can get nextcloud to display my videos. After changing 3 lines int the show function of the viewer.js it worked.

show : function () {
	// insert HTML
	var playerView = videoViewer.UI.playerTemplate
						.replace(/%src%/g, escapeHTML(videoViewer.location));
	playerView = playerView.replace(/type="%type%"/g, 'type="video/mp4"');
	if (videoViewer.inline === null) {
		var overlay = $('<div id="videoplayer_overlay" style="display:none;"><div id="videoplayer_outer_container"><div id="videoplayer_container"><div id="videoplayer"></div></div></div></div>');
		overlay.appendTo('body');
		$(playerView).prependTo('#videoplayer');
		// close when clicking on the overlay
		overlay.on("click", function (e) {
			if (e.target === this) {
				videoViewer.hidePlayer();
			}
		});
		// show elements
		overlay.fadeIn('fast');
	} else {

This is just a prove of concept and not an actual fix because i just removed the whole "tag" detection.

Teifun2 avatar Apr 29 '19 12:04 Teifun2

I don't really like such workarounds. As I understand it, "video/quicktime" is the correct MIME type for MOV files. If browsers handle the videos better when you supply the wrong MIME type, that's something that should be fixed on their end. I'd be surprised if this doesn't break anything in Safari, which has native MOV support.

The other trick mentioned seems like a less specific and better workaround if it works in all browsers:

<video controls>
  <source src="movie.mov" type="video/quicktime">
  <source src="movie.mov">
</video>

Instagit avatar Apr 29 '19 14:04 Instagit