masterofnone
masterofnone

Reputation: 1

YouTube video wants to download instead of load via jQuery

In short, mobile browsers try to download a random file instead of loading video into the main player Website.

More info:

I've built a webseries type site on WordPress, that uses jQuery to load a video into the main player: http://suzellediy.com/

Recently, I made it responsive - and now, when testing on mobile, when clicking on the video thumbnail, the video does not want to load into the main player.

Instead of loading the video, mobile Chrome and Safari wants to download the file instead. The issue cannot be recreated by using firebug / chrome mobile emulator.

Any ideas what the issue could be?

Upvotes: 0

Views: 264

Answers (1)

rsp
rsp

Reputation: 111446

Actually you may be able to reproduce the issue on the desktop when you disable Flash.

Try changing the URL in:

jQuery("#mainplayer").attr("src", "http://youtube.com/v/WKmUqV7abgw"+
  "?&autoplay=1&loop=1&listType=user_uploads&list=suzellediy");

To this:

jQuery("#mainplayer").attr("src",
  "https://www.youtube.com/embed/WKmUqV7abgw" +
  "?autoplay=1&loop=1&listType=user_uploads&list=suzellediy");

Or this:

jQuery("#mainplayer").attr("src",
  "https://www.youtube.com/embed/WKmUqV7abgw" +
  "?autoplay=1&loop=1&listType=user_uploads&list=suzellediy&html5=1");

and see if that works.

Most likely what you see is that mobile browsers that don't support Flash try to download a file if they can't play it.

Upvotes: 1

Related Questions