1

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

<script type='text/javascript'>
jwplayer('player_1234').setup({
   file: 'http://localhost/media.php?media_id=1822',
   type: 'm4a', 
   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 audio header() using readfile().

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

But jw player gives this error message "Cannot read property 'sources' of undefined" when page is loaded. How can I fix this error?

Schorsch
  • 7,761
  • 6
  • 39
  • 65
Rex Rex
  • 1,030
  • 1
  • 8
  • 29

1 Answers1

0

This is worked when type is changed to mp4 instead of m4a

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