RadioTunes Titanium SDK

RadioTunes Titanium SDK

This is the Appcelerator port of the successful RadioTunes SDK component. Using this component you can write powerful radio apps in Javascript and access all the features of RadioTunes SDK.

A Powerful Radio Streaming Framework for Appcelerator App Developers!

This is a port of the 5-star rated RadioTunes SDK for iOS component which was originally developed for the iOS platform. Now you can use this powerful radio streaming engine in your Appcelerator apps too and start writing radio apps in Javascript!

Behind the scenes RadioTunes relies on the iOS AudioQueue framework and the open source LGPL licensed FFmpeg library. If your app does not require mms/wma codec functionality you can also use the RadioTunes SDK without including the FFmpeg library. The code for mms streaming is completely separated from the code for http streaming so that you can choose which portions of code you want to include in your project.

Disclaimer: RadioTunes SDK can play all Window Media Audio version 9 streams but some streams based on version 10 could fail. This Appcelerator module will only work on iOS devices and does not support Android!

Make your App look like a Pro

Be sure to check out the Radiojive Template if you want a great looking design for your radio app. This template also includes a fully working radio app that uses RadioTunes SDK!

Download the FREE Trial now and see for yourself how simple it is to add radio playback functionality to your app!

Hide

Features

  • NEW FEATURE IN VERSION 2.1!
    • ASX playlist support.
  • NEW FEATURES IN VERSION 2.0!
    • Realtime audio recording.
    • Improved audio session management.
    • Bandwidth usage statistics.
  • Support for the http and mms protocols.
  • Supports mp3, aac, aac+ and wma audio streams.
  • PLS, M3U, ASX, XSPF and direct URL support.
  • Parsing of Shoutcast/Icecast metadata.
  • Automatic handling of interruptions like incoming phone calls.
  • Background playback.
  • Robust error handling.
  • Auto reconnect feature.
  • Works on Edge/3G/WiFi.
Hide

How to Use

To access this module from JavaScript, you would do the following:

var radiotunes = require("yl.radiotunes");

The radiotunes variable now holds a reference to the Module object.

Events

The radiotunes module fires 3 events to nofity you about audio session interruptions. You should handle these events like this:

radiotunes.addEventListener('begin_interruption', function(e) {
    if(myapp.radio === null) {
        return;
    }

    myapp.radio.pause();
});

radiotunes.addEventListener('end_interruption', function(e) {
    if(myapp.radio === null) {
        return;
    }

    if(myapp.radio.isPaused()) {
        myapp.radio.play();
    }
});

radiotunes.addEventListener('headphone_unplugged', function(e) {
    if(myapp.radio === null) {
        return;
    }

    // Pause radio if it's playing while headphones are unplugged
    if(myapp.radio.isPlaying()) {
        myapp.radio.pause();
    }
});

If you want to respond to the audio control buttons on the iPhone lock screen you should handle the following events:

radiotunes.addEventListener('remote_control_toggle_play_pause', function(e) {
    if(myapp.radio == null) {
        return;
    }

    if(myapp.radio.isPaused()) {
        myapp.radio.play();
    } else {
        myapp.radio.pause();
    }
});

radiotunes.addEventListener('remote_control_next_track', function(e) {
    // Add code to play next radio station here.
});

radiotunes.addEventListener('remote_control_previous_track', function(e) {
    // Add code to play previous radio station here.
});

radiotunes.createHTTPRadio

Use this function to create a Radio object for http streaming.

var radio = radiotunes.createHTTPRadio("http://some-host.com/radio")

radiotunes.createMMSRadio

Use this function to create a Radio object for mms streaming.

var radio = radiotunes.createMMSRadio("http://some-host.com/radio")

Radio Methods

  • play() - Start streaming.
  • pause() - Pause streaming.
  • startRecordingWithDestination(String path) - Start recording to the specified file path.
  • stopRecording() - Stop recording.
  • fileExtensionHint() - Returns the appropriate filename extension that should be used for recording.
  • shutdown() - This method should be called before disposing the radio object!
  • isPlaying() - Returns the value of the boolean playing property.
  • isPaused() - Returns the value of the boolean paused property.
  • isBuffering() - Returns the value of the boolean buffering property.
  • isRecording() - Returns the value of the boolean recording property.
  • setBufferInSeconds(Number seconds) - Sets the number of seconds to buffer before playback starts.
  • setVolume(Number volume) - Sets the volume. This value should be between 0 and 1.

Bandwidth Methods

The connection type parameter passed as argument to some of the functions must have one of the following values:

0 = All connection types
1 = WWAN connection type
2 = WiFi connection type
  • bandwidthUsageForConnectionType(Number type) - Reports the bandwidth usage for the specified network connection type.
  • resetBandwidth() - Resets the bandwidth usage for all network connection types.
  • resetBandwidthForConnectionType(Number type) - Resets the bandwidth usage for the specified network connection type.

Radio Events

metadata - Fired when the Shoutcast/Icecast metadata for the radio is parsed and ready.

myapp.radio.addEventListener('metadata', function(e) {
    if(e.name !== undefined) {
        Ti.API.info("Radio name: " + e.name);
    }
    if(e.genre !== undefined) {
        Ti.API.info("Radio genre: " + e.genre);
    }
    if(e.url !== undefined) {
        Ti.API.info("Radio url: " + e.url);
    }
});

title - Fired when the current playing item title is changed.

myapp.radio.addEventListener('title', function(e) {
    myapp.ui.titleLabel.setText("Now playing: " + e.title);
});

state - Fired when the state of the radio object is changed.

myapp.radio.addEventListener('state', function(e) {
    var state = e.state;
    if(state == 0) {
        myapp.ui.statusLabel.setText("Status: Stopped");
    } else if(state == 1) {
        myapp.ui.statusLabel.setText("Status: Connecting");
    } else if(state == 2) {
        myapp.ui.statusLabel.setText("Status: Buffering");
    } else if(state == 3) {
        myapp.ui.statusLabel.setText("Status: Playing");
    } else if(state == 4) {
        myapp.ui.statusLabel.setText("Status: Error");

        var error = e.error;
        if(error == 1) {
            myapp.ui.titleLabel.setText("Playlist could not be parsed.");
        } else if(error == 2) {
            myapp.ui.titleLabel.setText("File stream get property failed.");
        } else if(error == 3) {
            myapp.ui.titleLabel.setText("File stream could not be opened.");
        } else if(error == 4) {
            myapp.ui.titleLabel.setText("Audio queue could not be created.");
        } else if(error == 5) {
            myapp.ui.titleLabel.setText("Audio buffers could not be created.");
        } else if(error == 6) {
            myapp.ui.titleLabel.setText("Audio queue enqueue failed.");
        } else if(error == 7) {
            myapp.ui.titleLabel.setText("Audio queue could not be started.");
        } else if(error == 8) {
            myapp.ui.titleLabel.setText("Audio decoding error.");
        } else if(error == 9) {
            myapp.ui.titleLabel.setText("Radio host not reachable.");
        } else if(error == 10) {
            myapp.ui.titleLabel.setText("Network connection error.");
        }
    }
});

recording_started - Fired when recording has started.

myapp.radio.addEventListener('recording_started', function(e) {
    Ti.API.info("Recording started to path: " + e.path);
});

recording_stopped - Fired when recording has stopped successfully.

myapp.radio.addEventListener('recording_stopped', function(e) {
    Ti.API.info("Recording available at path: " + e.path);
});

recording_failed - Fired when recording has failed.

myapp.radio.addEventListener('recording_failed', function(e) {
    Ti.API.info("Recording failed: " + e.description);
    var code = e.code;
    if(code == 0) {
        Ti.API.info("Recording failed: initialisation error");
    } else if(error == 1) {
        Ti.API.info("Recording failed: file error");
    } else if(error == 2) {
        Ti.API.info("Recording failed: format error");
    } else if(error == 3) {
        Ti.API.info("Recording failed: write error");
    }
    myapp.ui.main.recButton.setImage('record_off.png');
});
Hide

Package

  • Complete source code of the RadioTunes SDK.
  • Complete source code of the Appcelerator module.
  • Detailed documentation with integration instructions.
  • Demo Javascript app.
  • Fully automated build scripts for FFmpeg that will build universal static libraries for the armv7, armv7s, arm64, x86_64 and i386 architectures.
  • Pre-built FFmpeg universal static libraries with support for the mms protocol and wma audio codec.
You need to log-in or create an account
  • Create an account
  • Log-in
Please use your real name.
Activation link will be sent to this address.
Minimum 8 characters
Enter your password again

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

X

Save your watchlist

Fill your details below to receive project updates from your watch list - including new versions, price changes and discounts.

I agree to the terms of use and privacy policy.

4 licenses, starting from From » $199.99 14 day money-back guarantee View Licenses
or Get a quote

for customization or integration services

  • Good communication, very responsive about updates, great module!
    M Mario
    2 years ago, 0 comments
    Was this helpful?
    Flag
  • It works perfectly without any problem.
    AB Achraf Bouyakhsass
    2 years ago, 0 comments
    Was this helpful?
    Flag
Post a comment

Or enter your name and Email
  • DM Digital Frontiers Media License holderSingle App License 4 months ago
    Hi. I'm kind of confused. I see that there have been multiple updates to the SDK since I purchased my original license. When I go to the Downloads section, under version 2.10 Binary, it says: Must be a license holder to download. PICK A LICENSE And then has a bunch of prices for a license. But I'm already a license holder. Do I need to buy a whole new license just to get a minor point revision update to upgrade my client's app?
    • Kemal Taskin Developer 4 months ago
      Hi, The binary version has a separate license. It's basically the same product without the source code. You should be able to download the versions that don't have the "binary" suffix. I would also like to mention that the single app license may not be suitable for client work. If you share the end-product (which has RadioTunes SDK's source code) with your client, your client will also have to purchase a license.
    • DM Digital Frontiers Media License holderSingle App License 4 months ago
      Understood. Thank you!
    • Kemal Taskin Developer 4 months ago
      Hi, Can you contact me at "***". I need to talk to you about your license.
    • DM Digital Frontiers Media License holderSingle App License 4 months ago
      Just sent you email from stephen at boostdfm dot com
  • PB Pablo Burmester 9 months ago
    Hi, is there any place where I can test this app or maybe some video or images? Thanks.
    • Kemal Taskin Developer 9 months ago
      Hi Pablo, You can download the demo which comes with a module that you can use in Appcelerator projects and example app code which features a simple radio app with recording functionality.
  • DM Digital Frontiers Media License holderSingle App License 2 years ago
    Hello, First off, thank you for sharing such great tools. Second, I apologize in advance for the long-winded question ahead but we're kind of desperate for some rather technical help/answers. We've been having issues with a client's SHOUTcast stream not playing on our Appcelerator iOS app ONLY on AT&T 3G network connections (works fine on Verizon 3G networks, Wi-Fi, etc.). This issue just suddenly "happened" one day in June 2012 for thousands of listeners in the Las Vegas region without us having pushed any sort of update or anything. We thought this was caused by some sort of throttling or provisioning change by AT&T on their 3G network at that time. However, the same stream seems to be accessible via the TuneIn Radio app. So it appears to be a combination of the built-in Appcelerator Titanium.Media.AudioPlayer object/methods, AT&T's 3G Network, and the client's SHOUTcast stream ( http://208.43.207.221:80/;listen.pls ). In the event that this SDK somehow circumvents this issue, we would push to immediately purchase and implement it within the app. Is there any way someone could test this SDK against the above stream on an iOS device using an AT&T 3G network connection so we could verify if we should pursue this SDK as an option? Thank you, Stephen
    • Kemal Taskin Developer 2 years ago
      Hi Stephen, The iOS version has a demo that you can try before purchasing the Appcelerator module: http://bit.ly/RadioTunesDemo. Both projects use the same code base so this should give you an idea wether the code works or not.
    • DM Digital Frontiers Media License holderSingle App License 2 years ago
      Perfect. Thank you! Will check it out!