1

I'm writing an iOS app that interacts with the Rhapsody music service SDK. I'm stuck at the point where I need to combine the RAD and EA portions of the music file. According to their docs:

After the track playback information has been returned, you can now begin retrieving the Rhapsody audio data. First, load the media URL property returned from the getTrackPlaybackInfos method into your client. Most of the Rhapsody formats allowed for streaming require a security method used by Rhapsody called RAD/EA. The RAD/EA security model allows for immediate download via HTTP of the majority of the track (known as the RAD portion of the audio). The client then downloads a small encrypted portion of the file (known as the EA portion of the file) every 30 seconds to constitute the entire music file.

If the media URL contains a RAD, call the getEA method to get the essential audio (EA). Use the session identifier, RAD version (3, unless otherwise told by your Rhapsody Direct representative), format, and bit rate returned from the cal to getTrackPlaybackInfos. You must call the getEA method multiple times to play back the entire audio track. The position parameter contains the offset in the EA block at which to start retrieving the audio data, and the count parameter contains the actual number of bytes to be returned. For example, on the first call to getEA, you would set the position parameter to 0 and could set the count parameter to 4096. This would return 4096 bytes of audio data starting at the beginning of the track. On the second cal to get EA, you would then set the position parameter to 4096 and the count parameter to 4096. On the third call, the position parameter would be 8192 and the count parameter 4096. Continue calling the getEA method until the entire track has played.

I can find the RAD file easy enough. But what I'm not clear on is how I re-combine the RAD and EA files into a streamable/playable media file? I think this is the 1st time Google has failed me. I cannot even find a hint about how to proceed.

double-beep
  • 5,031
  • 17
  • 33
  • 41
Jonathan Beebe
  • 5,241
  • 3
  • 36
  • 42
  • Did you manage to stream it? – pvllnspk Jan 18 '13 at 14:40
  • No. We could not get much help from Rhapsody either. After talking to them it sounds like they're redesigning/upgrading their system & api, not devoting many resources to this old one. So we're waiting/hoping they do, and that it's up-to-par with the api's of rdio and spotify. – Jonathan Beebe Jan 18 '13 at 17:59

1 Answers1

0
  1. About RAD/EA: on the Rhapsody site there are some samples how to get a playable music file from the input RAD and EA files (samples in Java and C++)

  2. RAD file we can download directly

  3. Problem with EA file - how to create it? In the documentation it's written that we need to call getEA method every 30 seconds, but the next questions arise here:

    • How to create an EA file (that as I understand should have a special structure with the special file headers) from the received from the WS getEA method bytes?
    • How to handle the OFFLINE mode if we need to call getEA method every 30 seconds to decode the RAD file?

If you have something to add - please feel free... I will be glad for any new info.

Solution:

  1. Download RAD file.

  2. Call getEA - we get here an array of some kind of the ASCII codes. Please see here how to convert it in the bytes array in Java: ASCII codes => string of characters

  3.         RadStream rs = new RadStream(getRadSource());
            Log.e(TAG, "" + rs.getHeader());
    
            EaStream es = new EaStream(getEaSource());
            Log.e(TAG, "" + es.getHeader());
    
            RadEaStream radea = new RadEaStream(rs, es);
    
            int counter = 0;
            FileOutputStream out = new FileOutputStream(fileWMA);
            for (int c = radea.read(); c >= 0; c = radea.read()) {
                out.write(c);
                counter += 1;
            }
            out.close();
    

For me it works.

Community
  • 1
  • 1
pvllnspk
  • 5,667
  • 12
  • 59
  • 97
  • I've been able to get their sample code to work fine. I'm also able to download both the RAD and the EA portions via the api. My problem is when I apply their sample code to the files I get from the api it fails to decode. I've not been able to get past that, and have not been able to get any help from Rhapsody thus far. – Jonathan Beebe Jan 18 '13 at 23:33