Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for multiple audio formats/codecs per track #50

Open
waynedpj opened this issue Nov 22, 2013 · 0 comments
Open

support for multiple audio formats/codecs per track #50

waynedpj opened this issue Nov 22, 2013 · 0 comments

Comments

@waynedpj
Copy link

ahoy,

we are looking to use cashmusic.js for our site and came across a possible issue and potential solution that may be helpful to others. due to the mess of HTML5 audio codec support we were planning on providing OGG Vorbis and AAC for each track to provide HTML5 audio for all browsers ala

<audio controls>
  <source src="track1.ogg" type="audio/ogg">
  <source src="track2.mp4" type="audio/mpeg">
</audio>

in order to avoid any Flash dependency and Flash block issues.

to that end we setup cashmusic.js/SoundManager2 to prefer HTML5 audio over Flash per this discussion:

// prefer HTML5 in SM2
window.onload = function()
{
    console.log('custom SM2 code starting ..');
    window.soundManager.reboot();
    window.soundManager.audioFormats.mp3.required = false;
    window.soundManager.preferFlash = false;
    soundManager.beginDelayedInit();
    console.log('custom SM2 code finished.');
}

and then used the support already in SM2 to provide a list of formats for each track to cashmusic.js (note the "url" property uses an [] array to submit tracks in multiple formats):

<div id="player1" class="cashmusic soundplayer playlist" data-playlist='
{
    "id":"player1",
    "artist":"artist",
    "album":"album",
    "tracks":[
            {"id":"unique1","track2":"track1","url":["track1.ogg","track1.mp4"]},
            {"id":"unique2","track2":"track2","url":["track2.ogg","track2.mp4"]}
                ]
}'
</div>

so far it seems to be working well on our end and hopefully this is the proper way to achieve this in cashmusic.js. if not, perhaps we could make the necessary changes to support this in whichever is the correct way.

peace, w

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant