Error Loading Media: File Could Not Be Played Error in Jw_Player Rails

Error loading media: File could not be played error in jw_player rails

Download jwplayer from http://www.longtailvideo.com/jw-player/download/

Put these files to the particular directory:-

  • app/assets/jwplayer/jwplayer.flash.swf
  • vendor/assets/javascripts/jwplayer.js
  • vendor/assets/javascripts/jwplayer.html5.js

Then add these line in application.js

//= require jwplayer
//= require jwplayer.html5

On the page where you are playing video, add these lines

<script type="text/javascript">jwplayer.key="YOUR_JWPLAYER_KEY";</script>
<div id="video">Loading the player ...</div>
<script type="text/javascript">
jwplayer("video").setup({
flashplayer: "<%=asset_path('jwplayer.flash.swf')%>",
file: "<%= file_path %>",
height: 360,
width: 640,
analytics: {
enabled: false,
cookies: false
}
});
</script>

https://account.longtailvideo.com/#/account from where you can get your Self-Hosted Player License Key (YOUR_JWPLAYER_KEY) in signing up from Get Your License Key portion.

Take a look https://github.com/shamsulsham89/jwplayer-rails3.2

Please test it first on Chrome Version 30

Using JW player getting errror loading file media could not be played

I am not sure about the stop() issue?

But you need to make sure both OGV and MP4 MIME TYPEs are set, and that the player is set up like:

<script>
jwplayer("myElement").setup({
playlist: [{
image: "/uploads/myPoster.jpg",
sources: [{
file: "/uploads/myVideo.mp4"
},{
file: "/uploads/myVideo.ogv"
}]
}]
});
</script>

jwplayer not recognizing file in rails

Thanks for your Response.

The problem is it is not recognizing flash player in rails. I given the path to player works great.

       jwplayer('myElement').setup({'flashplayer': "/assets/flash.swf", 'id': 'playerID', 'width': '540','height': '360', 'file': videopath });

It may help to somebody who working on this.

JWplayer: Display image on error without file parameter

If no file is provided, the player will fail to set up.

What you can do in this case, instead of using onError() like you do for when there is a media error, you can use onSetupError() instead, when the player fails to set up.

jwplayer().onSetupError(function() { /* DO SOMETHING */ });

Maybe find the div where the player fails to set up, then add an image using JS?

Here is a quick bit of sample code you can use:

<!DOCTYPE html>
<html>
<head>
<title>Template</title>
<script src="http://p.jwpcdn.com/6/12/jwplayer.js" type="text/javascript"></script>
</head>
<body>
<div id="player"></div>
<script type="text/javascript" language="javascript">
jwplayer("player").setup({
});
jwplayer().onSetupError(function() {
document.getElementById('player').innerHTML = '<img src="http://content.bitsontherun.com/thumbs/C4lp6Dtd-640.jpg" />'
});
</script>
</body>
</html>

Seems to work in my tests.

Web player not playing files with non-ASCII characters

As per ops request in the comments:

I would let them save with non-ascii characters, you don't want to make it harder for your users to upload.



Related Topics



Leave a reply



Submit