Coder Social home page Coder Social logo

flash-sound-player's Introduction

flash-sound-player

The simplest flash fallback for HTML5 audio playback available, written in under 50 LOC.

Why?

Because Firefox still can't play sounds without crashing, see https://bugzilla.mozilla.org/show_bug.cgi?id=744836.

Usage

Embed the swf in your markup:

<object id="flash_sound_player" type="application/x-shockwave-flash" data="flash_sound_player.swf" width="0" height="0" allowscriptaccess="always">
  <p>You should not see this if flash is working</p>
</object>

Use javascript to play a sound:

document.getElementById("flash_sound_player").playSound("http://assets.sauspiel.de/sounds/male/allgaeuerisch/greeting/begruessung-1.mp3");

Be sure to have a crossDomain.xml file on the host that allows the loading of the sound files, for more information see the Adobe Developer Conneciton site.

Need to detect Flash first? There you go.

var hasFlash = false;
try {
  ao = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
  hasFlash = ao != null;
} catch (e) {
  hasFlash = navigator.mimeTypes["application/x-shockwave-flash"] !== void 0;
}

Building

Get the Flex SDK, and set FLEX_HOME, e.g.:

export FLEX_HOME=~/Downloads/flex_sdk_4

and run ./build.sh.

© 2013 Martin Kavalar, Sauspiel GmbH

flash-sound-player's People

Contributors

mk avatar philippamarkovics avatar

Watchers

Leah Neukirchen avatar Dieter Komendera avatar James Cloos avatar

flash-sound-player's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.