Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. JavaScript Based Radio Player

JavaScript Based Radio Player

Scheduled Pinned Locked Moved JavaScript
javascripthtmlcomadobequestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ASPnoob
    wrote on last edited by
    #1

    Hi All, the most common radio players on websites are Flash based and they work great on desktop or laptop versions of of most websites. This is acceptable for many site owners but for some owners who want to be able to reach listeners on mobile devices it is problematic. Flash based players are not supported by mobile devices. One could say why don't you register your site with such websites as tunein.com or itune so that your listeners can listen to you with their mobile devices. The reasons for that vary from owner to owner. So having said all that, is it possible to create a player with JavaScript that will handle streams? I have created an interface for a radio player as follows but it does not work.

    <button onClick="document.getElementById('audio').play();document.getElementByID('audio').volume=1;">Play</button>
    <button onClick="document.getElementById('audio').pause()">Pause</button>

    Then I tried to use the Source attribute of HTML5 Audio element to hand the radio stream as follows:

    Unfortunately the HTML5 Audio Element does not handle streams, it only handles files. I would like to create a JavaScript radio player code that I can place on any website to allow listeners on mobile devices to listen to online radio stations of their choice. Please point me in the right direction, thanks in advance.

    J T 2 Replies Last reply
    0
    • A ASPnoob

      Hi All, the most common radio players on websites are Flash based and they work great on desktop or laptop versions of of most websites. This is acceptable for many site owners but for some owners who want to be able to reach listeners on mobile devices it is problematic. Flash based players are not supported by mobile devices. One could say why don't you register your site with such websites as tunein.com or itune so that your listeners can listen to you with their mobile devices. The reasons for that vary from owner to owner. So having said all that, is it possible to create a player with JavaScript that will handle streams? I have created an interface for a radio player as follows but it does not work.

      <button onClick="document.getElementById('audio').play();document.getElementByID('audio').volume=1;">Play</button>
      <button onClick="document.getElementById('audio').pause()">Pause</button>

      Then I tried to use the Source attribute of HTML5 Audio element to hand the radio stream as follows:

      Unfortunately the HTML5 Audio Element does not handle streams, it only handles files. I would like to create a JavaScript radio player code that I can place on any website to allow listeners on mobile devices to listen to online radio stations of their choice. Please point me in the right direction, thanks in advance.

      J Offline
      J Offline
      jkirkerx
      wrote on last edited by
      #2

      To the best of my knowledge and in my opinion Flash is a very mature and stable platform, although others or perhaps now the majority of people will say that's it's a memory and CPU hog, a security risk, etc. But I write Flash AS3 code, and have created many different applications with it, such as my own You Tube style movie player. Flash AS3 is pretty neat because it handles movie and audio streams very well, and can buffer streams from a stream server, while showing the progress. Now take You Tube, they had to write a iphone app and a android app to play there movies on mobile devices, to replace the flash movie player Since JavaScript runs in the DOM of a browser, I seriously doubt that you can stream audio with it, and buffer the stream if needed, because of the JavaScript architectural. JavaScript runs when a function is called for it, and just completes. It's sort of linear in design. It doesn't wait for events in motion to occur. Now take a windows application, windows has a message pump, and the pump constantly runs, waiting for messages, and then processes them. Well flash does that as well, but JavaScript doesn't. JavaScript doesn't have the pump mechanism, that goes round and round waiting for events to occur. I have no alternatives to offer, but you could of just Googled your question.

      1 Reply Last reply
      0
      • A ASPnoob

        Hi All, the most common radio players on websites are Flash based and they work great on desktop or laptop versions of of most websites. This is acceptable for many site owners but for some owners who want to be able to reach listeners on mobile devices it is problematic. Flash based players are not supported by mobile devices. One could say why don't you register your site with such websites as tunein.com or itune so that your listeners can listen to you with their mobile devices. The reasons for that vary from owner to owner. So having said all that, is it possible to create a player with JavaScript that will handle streams? I have created an interface for a radio player as follows but it does not work.

        <button onClick="document.getElementById('audio').play();document.getElementByID('audio').volume=1;">Play</button>
        <button onClick="document.getElementById('audio').pause()">Pause</button>

        Then I tried to use the Source attribute of HTML5 Audio element to hand the radio stream as follows:

        Unfortunately the HTML5 Audio Element does not handle streams, it only handles files. I would like to create a JavaScript radio player code that I can place on any website to allow listeners on mobile devices to listen to online radio stations of their choice. Please point me in the right direction, thanks in advance.

        T Offline
        T Offline
        twseitex
        wrote on last edited by
        #3

        Streamed data Please use a server for streaming. Adobe server is not freeware. Adobe Action Script is not compatible every time (non compatibles upgrades and not cheap). WebM (HTML-5-audio) can be streamed. Ogg-format too. Security of streaming: Maybe server an folder of audio data must be on same host. Javacript only client language. WebM-player (streamed WebM too) is a component of html-5-browsers. Flash not. Player controls in use of JavaScript - yes. I have a webpage (twseiten.com) - there e.g. client side html-5-player but NOT streamed data.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups