Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 11
Registered: ‎08-19-2008
My Device: 9700 Bold
Accepted Solution

JSR 211 - Not launching Media Player to play .wav files

 

The Media Player is not launching to play .wav files. We have a core library that contains shared code used by multiple applications. All of the JSR211 code is located in the library for two reasons: used by multiple applications, and all our applications support 4.2.1 OS. The JSR211 plugin is not installed on devices with OS < 4.3

 

Media Content Type: audio/wav

Media Suffix: .wav

Issue Reproduce on BlackBerry OS: 4.5.0 and greater. Did not try to reproduce on 4.3 OS devices.

 

Code in Library

 

public final class JSR211
{
   public static JSR211ContentHandler forSuffix( String className, String suffix )
   {
      Registry registry = Registry.getRegistry( className );
      ContentHandler[] handlers = registry.forSuffix( suffix );
      return convertContentHandlersToJSR211ContentHandlers( handlers );
   }

   public static void invoke( String className, JSRContentHandler handler )
   {
      Registry registry = Registry.getRegistry( className );
      Invocation i = new Invocation();
      i.setURL( handler.getURL() );
i.setType( handler.getContentType() ); i.setID( handler.getApplicationId() ); i.setResponseRequired( false ); registry.invoke( i ); } }

 

 

Code in UI Application

 

public final class AttachmentManager
{
   private String CLASS_NAME = "net.myapp.MyApp";

   public boolean launchAttachment( MyAttachment attachment )
   {
      boolean retVal = false;
      JSR211ContentHandler handlers[] = JSR211.forSuffix( CLASS_NAME, ".wav" );
      if( handlers.length > 0 )
      {
         JSR211.invoke( CLASS_NAME, handlers[0] );
         retVal = true;       
      }       
      return retVal;    
   }
}

I am using the class name of the UI application and passing it to the library to use in order to access the Registry. When I moved the Registry.getRegistry( className ) to the UI application the Media player was detected by JSR211 and launched to play the .wav file. When I moved the code to the library the JSR211 does not detect the Media player anymore. Does anyone know why this is the case?

 

Note: I can not use any of the JSR211 classes in the UI app because our application supports 4.2.1 OS devices. The code must stay in the library.

 

Thank You for your help.

 

Fares Bouchedid
Software Engineer
Notify Technology Corporation
www.notifycorp.com
New Developer
Posts: 11
Registered: ‎08-19-2008
My Device: 9700 Bold

Re: JSR 211 - Not launching Media Player to play .wav files

Should I post this problem in the issue tracker?

Fares Bouchedid
Software Engineer
Notify Technology Corporation
www.notifycorp.com
Developer
Posts: 212
Registered: ‎07-18-2008
My Device: Storm 9550

Re: JSR 211 - Not launching Media Player to play .wav files

getting the registry is tricky with CHAPI at least on BlackBerry. You have to use the name of the current application. It must be the current one, the one that invokes enterEventDispatcher()! It won't work otherwise.

Try using Application.getApplication().getClass.toString() to have it interchangeable.

I am also using CHAPI code in a library because of backward compatiblity, it should work just fine.

If your problem was solved, please mark answer as "Accepted solution"
If your want to thank, click the "kudo" symbol
___________
visit me: http://mobilejavadevelopment.blogspot.com/
visit the Berlin BlackBerry Developer Group: http://berlinblackberrydevelopers.blogspot.com/
New Developer
Posts: 11
Registered: ‎08-19-2008
My Device: 9700 Bold

Re: JSR 211 - Not launching Media Player to play .wav files

Thank You for the reply.

I did change the code to use the Application.getApplication().getClass().getName().

 

JSR211 works fine for all file types. The only thing that it doesn't work for is the .wav file.

Can you test your library by searching for ".wav" using the forSuffix function and see if the Media handler is returned.

 

Let me know what you come up with and Thank You again for helping out.

Fares Bouchedid
Software Engineer
Notify Technology Corporation
www.notifycorp.com
Developer
Posts: 212
Registered: ‎07-18-2008
My Device: Storm 9550

Re: JSR 211 - Not launching Media Player to play .wav files

ah ok sorry was a misunderstanding.

I'll try it.

Maybe one idea for now: try to search by mime type instead of suffix. Maybe he just can not map file extension to mime types.

If your problem was solved, please mark answer as "Accepted solution"
If your want to thank, click the "kudo" symbol
___________
visit me: http://mobilejavadevelopment.blogspot.com/
visit the Berlin BlackBerry Developer Group: http://berlinblackberrydevelopers.blogspot.com/
New Developer
Posts: 11
Registered: ‎08-19-2008
My Device: 9700 Bold

Re: JSR 211 - Not launching Media Player to play .wav files

Same result as forSuffix function. I also tried ".wav" and "wav".

The content type I am getting with the wave file is audio/wav.

Fares Bouchedid
Software Engineer
Notify Technology Corporation
www.notifycorp.com
Developer
Posts: 212
Registered: ‎07-18-2008
My Device: Storm 9550

Re: JSR 211 - Not launching Media Player to play .wav files

[ Edited ]

Hi, sorry it took so long.

It worked for me BUT take another Mimetype.

 

it seems to be:   audio/x-wav

 

 

This is the debug output of the Content Handler with all supported types:

 

            _classname    "net.rim.device.apps.internal.explorer.content.MediaContentHandlerApplication" (id=793018368)   
            _ID    "net.rim.bb.mediacontenthandler" (id=792977408)   
            _types    String[79]  (id=793116672)   
                [28]    "audio/x-mpegurl" (id=794296320)   
                [29]    "audio/midi" (id=794337280)   
                [30]    "audio/midi" (id=794378240)   
                [31]    "audio/midi" (id=794419200)   
                [32]    "audio/midi" (id=794460160)   
                [33]    "audio/midi" (id=794501120)   
                [34]    "video/3gpp" (id=794542080)   
                [35]    "video/3gpp2" (id=794583040)   
                [36]    "video/mp4" (id=794624000)   
                [37]    "video/x-msvideo" (id=794664960)   
                [38]    "video/quicktime" (id=794714112)   
                [39]    "video/divx" (id=794755072)   
                [40]    "video/mpeg" (id=794796032)   
                [41]    "video/x-ms-asf" (id=794836992)   
                [42]    "video/x-ms-wm" (id=794877952)   
                [43]    "video/x-ms-wmv" (id=794918912)   
                [44]    "video/x-ms-wmx" (id=794959872)   
                [45]    "audio/mpeg" (id=795000832)   
                [46]    "audio/mpeg" (id=795041792)   
                [47]    "audio/x-wav" (id=795082752)   
                [48]    "audio/x-wav" (id=795123712)   
                [49]    "audio/amr" (id=795164672)   
                [50]    "audio/3gpp" (id=795205632)   
                [51]    "audio/3gpp2" (id=795246592)   
                [52]    "audio/mp4" (id=795287552)   
                [53]    "audio/aac" (id=795328512)   
                [54]    "audio/x-gsm" (id=795369472)   
                [55]    "audio/x-ms-wma" (id=795410432)   
                [56]    "audio/qcelp" (id=795451392)

If your problem was solved, please mark answer as "Accepted solution"
If your want to thank, click the "kudo" symbol
___________
visit me: http://mobilejavadevelopment.blogspot.com/
visit the Berlin BlackBerry Developer Group: http://berlinblackberrydevelopers.blogspot.com/
Highlighted
New Developer
Posts: 11
Registered: ‎08-19-2008
My Device: 9700 Bold

Re: JSR 211 - Not launching Media Player to play .wav files

I do not have control over the content type. That is sent from the server. And if audio/wav is not found ".wav" or "wav" suffixes should work and launch the Media Player. I will submit this issue to the Issue Tracker. If anyone else have anymore input or ideas please post thanks.

 

Thank You dpreussler for your time.

Fares Bouchedid
Software Engineer
Notify Technology Corporation
www.notifycorp.com