Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

What file type to pass to player?

7 replies [Last post]
Reply
<script type="text/javascript">
   jwplayer("mediaplayer").setup({
    "modes": [
        {type: "html5"},
        {type: "flash",
        {src: 'media/mint/jwplayer/player.swf"},
{type: "download"}
     ]
});
</script>

This is how I set up th player. I use it to play only audio files. i also set size and controls but those are not important for my question. Now in the bottom I have

<ul>
<li>Mozart #1</li>
</ul>

This all works great no problems. I have long list of audio there. Here is what i cannot solve

1. In firefox it loads HTML5 although it does not support MP3 in html 5 and when I click it does not work. I know I can solve it by pointing initial file for it and if it is MP3 it will load flash but here is next problem.

2. I have 3 file types on the server. It is MP3, OGG or sometimes WAV. It depends what file is uploaded. But I have at least 2 file versions to be suported in every browser with HTML5.

Can I somehow in jwplayer().load('/mozart.mp3') indicate few files and let player detect what if the best format to play?

Reply

It eraised in LI I have onclick="jwplayer().load('mozart.mp3')"

Reply

What I mean it is easy in <audio> tag

<audio controls="controls">
  <source src="song.ogg" type="audio/ogg" />
  <source src="song.mp3" type="audio/mp3" />
  Your browser does not support the audio tag.
</audio>

I pass few formats and browser detects itself what is best format for it.

Reply

I would use the following

  1. oga
  2. mp3
  3. aac

I prefer to use the oga as this will differentiate the audio from the video which I use ogv.

Although both are of the ogg envelope just simply rename the file's extentsion

that is to say

for audio ogg --> oga
for video ogg --> ogv

Hence when lookign for a particular file it will make life alot easier IMHO

Reply

That is what i use as well. The question is not what format I have to use at all. Ho do I pass information of 2 files ogg and acc on player initialization.

If I use only mp3, then it loads flash in FF. And if ogg, then flash in chrome.

The core HTML 5 audio allow you to enter alternative sources. And browser detects itself what to play. In JWPlayer it seams that i have to write logic what to pass to player, because I can only pass 1 file.

Reply

The JWPlayer will do that automatically for you

Reply

So how to pas 2 files to JW player?

Reply

Do something like:

var playlistItem = {
  levels: [{
    file: 'audio.mp3'
  }, {
    file: 'audio.ogg'
  }],
  image: 'thumb.jpg'
};

jwplayer().load(playlistItem);

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • You may post code using <code>...</code> .
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options