Streaming Player API – Bringing the Big Screen to the Small Screen

Dev Con

It’s out, folks – the Streaming Player API has now been published with full source code!

During the BlackBerry Developer Conference in 2009, I hosted a session where we discussed the best practices for developing Media Streaming applications. I want to give a big round of thanks to all the participants for sharing their stories – you really helped me to come up with an open source API module for streaming audio and video that simply works out of the box! Sample code or API, whatever you’d like to call it – the central idea was to provide you with something that was as simple as saying “play this URL over HTTP” or “seek to 2:20.”

The StreamingPlayer class is the starting point of this API. It does all the heavy lifting related to implementing a DataSource and a SourceStream, managing a ring buffer, synchronizing playback, download and user action threads, and last but not least, handle OS and user-initiated seek calls in an efficient way by fully considering the limitations of HTTP streams.

On top of the features mentioned above, the API also has enough public methods and constants for all you adventurers out there. A StreamingPlayerListener interface can notify an application about every streaming event you will ever need, as well as a mechanism (my favorite) to preprocess each chunk of downloaded data before it’s sent to the underlying Player. This preprocessing should be useful for decrypting encrypted content, or if you would like to parse meta information from the raw stream.

I welcome everybody to join me in making this a success by providing your valuable feedback and comments. A Knowledge Base article, Streaming media – Start to finish, has already been published; you can read more about it and download the code there. If you have any questions, feel free to point and shoot at me but do not hesitate to submit any issues or feature requests in the BlackBerry® Issue Tracker. I will be following the issue tracker on a daily basis.

Until next time, happy streaming!

Join the conversation

Show comments Hide comments
+ -
  • Ryan Nickel

    This is amazing! Thanks SO much for sharing this! Can't wait to implement this feature into one of my projects!

  • Mohamed Shaheen

    what about streaming out ? , capture the camera and stream it live to the server .
    same model as Qik

  • ysnky

    i tried but not worked. i tested jde 4.5 simulator with 3gp stream over http. :((((((
    i am serious converns about that blackberry plays video over http. cause this code given below is not work either. and there is no solution to people on the forums which refer this article.

  • mkirkup


    I am sorry to hear that you were experiencing issues. If you could log more details about your problem in the Developer Issue Tracker ( we can have someone work with you to better understand the problem. Right now we don't have enough info to help you.

  • Preetam Purbia

    I am trying to play shoutcast stream ( )on Blackberry Curve 8900 – javelin
    but its not playing. I tried following approches
    1) by removing from the streaming url “;deviceside=true”
    2) by creating a socketconnection and passing inputstream to streamplayer
    3) I also tried with chaudcast player but no luck.

    Can you guide me what to do. Is streaming can be possible on curve 8900
    via (HttpConnection), Connector.READ_WRITE);
    or i have to use socket connection approch.

    I also tried with MFradio ( but
    it is throughing outofmemory exception [due to vector; playerrunner and playermaker threads not working properly on blackberry platform while its working perfectly on nokia s40 platform]


  • Shadid

    Hi Preetam,
    The constructor that takes an InputStream is not fully implemented yet. If you would like to collaborate here, please let me know!

    For the time being I would recommend you use the constructor that takes an http URL and use StreamingPlayerListener.preprocessData(..) to access the streamed data. The details of that method is well documented in the source. I have tested shoutcast stream before. It should definitely work.

  • Preetam Purbia

    Hi Shadid,
    I think the issue i am facing because of Connection Suffix.
    here is connectionSuffix generator which i m trying to use
    String updateConnectionSuffix()
    String connSuffix;
    if (DeviceInfo.isSimulator()) {
    connSuffix = “;deviceside=true”;
    } else
    if ( (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) &&
    RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN)) {
    } else {
    String uid = null;
    ServiceBook sb = ServiceBook.getSB();
    ServiceRecord[] records = sb.findRecordsByCid(“WPTCP”);
    for (int i = 0; i < records.length; i++) {
    if (records[i].isValid() && !records[i].isDisabled()) {
    if (records[i].getUid() != null &&
    records[i].getUid().length() != 0) {
    if ((records[i].getCid().toLowerCase().indexOf(“wptcp?”) != -1) &&
    (records[i].getUid().toLowerCase().indexOf(“wifi”) == -1) &&
    (records[i].getUid().toLowerCase().indexOf(“mms”) == -1) ) {
    uid = records[i].getUid();
    if (uid != null) {
    // WAP2 Connection
    connSuffix = “deviceside=true;ConnectionUID=”+uid;
    } else {
    connSuffix = “;deviceside=true”;
    return connSuffix

    Guide me about this.

  • Preetam Purbia

    Here are the device details on which i am testing
    Device Name: 8900
    Platform Version:
    Software Version:
    Connection Suffix Value: ;deviceside=true
    I am using eclipse for compiling [with jre 5.0.0]and signing,

    so your implemented streamplayer will work on this device?

  • Preetam Purbia

    Sorry for scattered posts
    One more thing i want to tell you
    i am using BES device.
    So, this parameter need to suffix with connection url “;deviceside=false”. ?
    Or i can use open connection without any connection parameters.

  • Shadid

    It's great to see your interest in this!

    For media streaming, we strongly recommend using TCP Cellular (;deviceside=true) or the WAP2 transport (;deviceside=true;ConnectionUID=[WAP2 UID]). To isolate the problem,

    Also, please note that our compilers are only forward compatible. You cannot compile an app using BlackBerry JRE5.0 and run on OS 4.6.1. It needs to be compiled using a BlackBerry JRE version less than 4.6.1. Otherwise there can be compatibility issues.

    Can you please try the following?
    1. Go to device Options>Advanced Options>TCP and make sure that the correct APN information is set for your carrier. This is mandatory when you are using TCP-Cellular transport (;deviceside=true).
    2. Launch Streaming Player sample app.
    3. Go to options from the menu.
    4. Directly enter the url and append “;deviceside=true”.
    5. Make sure the content-type specified is correct and matches that of the stream you are trying to play.
    6. Go back.
    7. Hit play from the menu.

  • Shadid

    Hi Mohamed,
    Great idea! You can easily accomplish this in BlackBerry OS 5.0 or above via the VideoRecording API. Please see

  • Dubey Ankit

    Hi All
    I am trying to implement RTSP protocol stack. I am getting the audio and video data as RTP packets , i am able to parse the payloads, but somehow the player is not understanding these audio/video processed packets.


  • Luis Gerardo Lopez Cienfuegos

    This API is wonderful! I've already tested it successfully in a BB Tour 9630 and the audio and video both are amazing!
    I've just one problem with the video, because it shows up on top of the PlayerScreen, hiding the TimeLineFields. Is there any way to render this controls on top of the video?

    Thanks in advance!

  • Shadid

    Hi Luis,
    Unfortunately there is no way to draw overlays on top of videos today.


  • Fastidias

    Hi, great API.
    But i have a Problem. Iam using Storm 9500 and when i hit the pause button during the Player is buffering and not playing the vid i got a freezeScreen. Had to remove the battery and restart. The debuggeer says something like this after i hit the button…

    [STREAM] allocating big buffer [index: 0] [numStreams: 0]
    [STREAM] allocating stream [index: 0] [size: 327680]
    [STREAM] allocated stream [index: 0] [handle: 2818] [size: 327680]
    null:_ss=2818 PID=213

  • Tamal Mukherjee

    I’m getting intermittent error “ConnectionClosedException” from the Streaming Player. It seems the exception comes from the Downloader thread, in the following line:

    while (-1 != (len = { // ConnectionClosedException (not catched by Throwable!)

    Here is the event log

    Stream closednet_rim_io_impl(4C48DDAA)
    TcpInputStream checkForClosed 0x29D0net_rim_io_impl(4C48DDAA)
    TcpInputStream read 0x285Anet_rim_os-3(4C48E1DA)
    LengthControlledInputStream read 0x4A48net_rim_cldc-1(4C48DD41)
    InputStream read 0x418FMyVideoApp-3(4CB1656F)
    StreamingPlayer$Downloader run 0x1A83

    I’ve compiled it on OS 4.6 and trying to run it on 4.6/4.6.1/5.0/6.0. The error comes on OS 6.0 most of the time.

    Any help will be appreciated.

  • Tiger79

    I have been trying this, and I noticed that the “external” CircularByteBuffer class has apparently changed… The class (for example) imports the java.nio.BufferOverflowException library, which is only available from version JRE5.0… also some calls to it in the Blackberry Streaming Media API aren’t anymore correct…
    Any chance that the “old version” of the CircularByteBuffer class is somewhere available ?

  • ss123

    the app does not play video’s of large size, say 5 MB +.
    i tried changing the buffer size, but no sucess, please help

  • Deepali Dhingra

    Hi Ankit,
    Did you get the solution to your problem. I am also stuck at the same point.
    i am removing 12 byte header from the RTP packets.
    Can you please Help??

blog comments powered by Disqus