Rex Rex
Rex Rex

Reputation: 1030

jw player video not working if source is content type video

I am using this code in jw player to play video.

<script type='text/javascript'>
jwplayer('player_1234').setup({
   file: 'http://localhost/media.php?media_id=1822',
   width: '100%',
   plugins: {},
   aspectratio: '16:9',
  fallback: 'false',
   primary: jwplayer.utils.isChrome() ? "html5" : "html5"
   });
</script>

Here, media.php file returns the the proper content-type video header() using readfile().

Media.php works fine when i directly enter in browser.

But jw player gives this error message "Error loading player: No playable sources found" when page is loaded. Please help to solve this problem.

Upvotes: 1

Views: 774

Answers (2)

KesaVan
KesaVan

Reputation: 1031

Try this:

For the id use this way

'id': 'playerID',

Add the following:

'type': 'mp4',

Now, the php file should work as the player's "file" variable, It will work fine.

Upvotes: 2

TBI
TBI

Reputation: 2809

To Use jwplayer you have to give the path to video file to get it working.

file: 'path_to_your_video_file.mp4',

Upvotes: 2

Related Questions