jlowcs
jlowcs

Reputation: 1933

Jwplayer 7.0.3 with flash 18 not playing videos, while HTML is working fine

Although it works well ni html5 mode with mp4 files, the player does not play neither flv files in flash mode, nor mp4 files in flash mode. In Chrome (44.0.2403.157) nd Firefox (40.0.3), it's loading indefinitely.

What is even stranger is that the player from the jwplayer dashboard (https://dashboard.jwplayer.com/#/players/basic_setup) manages to play flv files when loading them from the console using the following call:

jwplayer(document.querySelector('.jwplayer')).load([{ file:'http://www.sample-videos.com/video/flv/720/big_buck_bunny_720p_1mb.flv' }]);

Here's a jsfiddle showcasing the issue:

https://jsfiddle.net/kLdmj42d/ (make sure you specify a license key)

Just toggle the comments on the mp4 and flv files to make sure it actually works with the mp4 file.

HTML:

<div class="main">
    <div id="player">
    </div>
</div>

JS:

jwplayer.key = "";
jwplayer.defaults = {
  aspectratio: "16:9",
  autostart: false,
  controls: true,
  displaydescription: false,
  displaytitle: true,
  flashplayer: "//ssl.p.jwpcdn.com/player/v/7.0.3/jwplayer.flash.swf",
  height: 260,
  mute: false,
  ph: 1,
  //plugins: {"http://assets-jpcust.jwpsrv.com/player/6/6124956/ping.js": {"pixel": "http://content.jwplatform.com/ping.gif"}},
  primary: "html5",
  repeat: false,
  stagevideo: false,
  stretching: "uniform",
  width: "100%"
};

jwplayer(document.getElementById('player')).setup({
  file: 'http://www.sample-videos.com/video/flv/720/big_buck_bunny_720p_1mb.flv'
  //file: 'http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4'
});

I also posted the issue on JwPlayer's website: http://support.jwplayer.com/customer/portal/questions/14332602-jwplayer-7-3-with-flash-18-not-playing-videos

Upvotes: 1

Views: 1567

Answers (2)

jlowcs
jlowcs

Reputation: 1933

The issue is that, apparently, the JwPlayer flash player needs access to window.jwplayer to work.

But, obviously, when using AMD, window.jwplayer is never set.

Until there's a fix, the workaround is to set window.jwplayer in the app's code.

As for jsfiddle, as I said in a comment, it doesn't work because of a sandboxed iframe.

http://support.jwplayer.com/customer/en/portal/questions/14351203-jwplayer-7-3-with-flash-18-not-playing-videos?new=14351203

Upvotes: 1

emaxsaun
emaxsaun

Reputation: 4201

Odd, while this doesn't work in the JS Fiddle, when I load the following on my local, everything works fine:

<!DOCTYPE html>
<html>
<head>
    <title>Template</title>
    <script src="http://p.jwpcdn.com/player/v/7.0.3/jwplayer.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">jwplayer.key = "YOUR_KEY";</script>
</head>
<body>
    <div id="player"></div>
    <script type="text/javascript" language="javascript">
    jwplayer("player").setup({
        file: "http://www.sample-videos.com/video/flv/720/big_buck_bunny_720p_1mb.flv"
    });
    </script>
</body>
</html>

Upvotes: 0

Related Questions