11-03-2009 03:35 PM
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
03-01-2010 02:09 PM
I had the exact same problem trying to play an mp3 file -- very frustrating. But I found you can get around this by playing audio in the browser. Here's an example using an audio file pre-installed in OS 4.5:
BrowserSession soundclip = Browser.getDefaultSession();
soundclip.displayPage("file:///store/samples/ringt
All the bugs with trying to close the player using the excape key, and then trying to play audio again, seem to be gone. Hope that helps.
04-26-2010 11:47 AM
Thanks you, BBinIdaho - that really helped.
Although this approach is suggested in BB multimedia guide - this solution has totally fallen out of my head - thanks for reminding