Select Language
New Contributor
kcheng86
Posts: 6
Registered: 09-22-2009
0

problem invoking media content handler repeatedly

Hi,

 

I need to be able to play different files for user to view  (audio or text) using content handler but there is some problem. my environment is

 

Blackberry 9000, v4.6.0.162.  Component pack 4.6.1

 

the code is :

 

 

 

 

 

 

 

 

 

 

 

Invocation invocation =

new Invocation(uri, null

,

BlackBerryContentHandler.

ID_MEDIA_CONTENT_HANDLER

);

 

 

// Get the registry object

Registry registry = Registry

.getRegistry(

"aw.myproject.screens.TaskDetailsScreen"

);

 

 

 

try

{

 

boolean

result = registry.invoke(invocation);

Logger.getLogger().debug(

 

"invocation " + invocation.getURL() + " result "

+ result);

}

catch (IllegalArgumentException e) {

Logger.getLogger().error(

"invocation error "

+ e.getMessage());

 

}

catch  (ContentHandlerException e) {

Logger.getLogger().error(

"invocation error "

+ e.getMessage());

 

}

catch  (SecurityException e) {

Logger.getLogger().error(

"invocation error "

+ e.getMessage());

 

}

catch  (IOException e) {

Logger.getLogger().error("invocation error "  + e.getMessage());

 

}

catch  (Exception e) {

Logger.getLogger().error(

"invocation error "

+ e.getMessage());

}

 

What happens is:

 

When I call this code to play some file for the first time, everything works, a media player instance shows up and plays the file. 

 

Now if I close the media player instance with the escape button, and call the same code again for a different file it also works fine, just as the first time.

 

Now if I leave the media player instance open, switch to home screen and open my user application again and choose the play another file with the above code, I can see the screen switch to the media player instance very shortly then switch back to my app, file is not played.   This other file is valid as I could still use media player application to navigate to the file location and play it.

 

please help with my problem to play another file.

Thanks