10-29-2010 05:43 AM
We are developing a Widget Application for BB 5.0 devices, and we need to play some Video files from the application.
But, it seems like the BB browser is unable to play the video, I tried with m4v and mp4 formats.
I am using <EMBED> tag as follows -
<embed type="video/mp4" src="big_buck_bunny.mp4" ></embed> It gives me Null Pointer Exception.
I have also tried with the <OBJECT> tag but no luck at all.
Amazing thing is, my video plays just fine when I give it as HREF to <A> tag.
Seems like the root problem lies in <EMBED> & <OBJECT> tag.
If anyone can tell me what the secret formula is, or point me to a real web page that shows how a Blackberry can directly play an embedded mp4 or any other video file, I would greatly appreciate it.
11-02-2010 08:56 AM
Unfortunately this is due to is a known issue with embedding the media player directly within a BrowserField object (BrowserField is the Class is used by the WebWorks framework to display web content in the standalone app).
This issue has been logged as a defect and is being worked on. No ETA on when a fix is available. Have your voice heard by logging this and voting on it in the Developer Issue Tracker.
For the time being, a workaround is to invoke the native BlackBerry media player application, rather than embedding the content directly in the app. Some of the benefits of this are that the media player is able to handle caching / buffering, users have access to input controls and of course the video plays on a larger screen area. Since the BlackBerry is a multi-threaded OS, the media player simply sits on top of your application while the user is interacting with the video. When they are finished and close the video, they are returned to your app.
The cleanest solution is to either create a direct hyperlink to the video file (as you mentioned in your post) or use the WebWorks invoke API to launch the media URL to the browser application. This launches the browser, which identifies the content as video media and then launches the media player. As background to those interested, behind the scenes, the browser is using the content handler API (CHAPI) to perform this analysis.
02-04-2011 08:01 AM
This approach conflicts with a bug in the 9800 simulator - it cannot open more than one webkit instance (fails with the error "Failed to create a second process", and thus cannot resolve the URL into something playable by the media app.
Bit of a pain when developing, tbh
02-04-2011 10:27 AM
Which version of the 9800 simulator? I know there were some early versions of the simulator that had some integration issues with the WebKit browser.