| Reply | « Previous Thread | Next Thread » |
|
Hello. I am a new guy in J2ME.
I want to do a sample about reading video files, and I always get a null pointer error. 1.The following code is to download a video from URL and play it. InputStream is = HttpConn.urlToStream("http://myserver/video.mpg"); String contentType = "video/mpeg"; if (is == null) { //error return; } Player player = Manager.createPlayer(is, contentType); if (player == null) { //error return; } player.addPlayerListener(this); //This class extends Canvas implements CommandListener, PlayerListener player.prefetch(); player.realize(); VideoControl videoControl = (VideoControl)(player.getControl("VideoControl")); Then I get a null videoControl.Why? I am sure is and player are not null, and I can play the video if I open it in website. 2.I also tried to open a local video file and play it. I read a lot of online source codes(include the MediaSampler). They use getClass().getResourceAsStream() to get the InputStream from jar file. But no one tell me how to get the InputStream if the video file path is just like "C://Videos/video.mpg". Can anyone tell me the way? Thanks in advance. ![]() |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Please its veru urgent on nokia 3250 | siva_guduru | Mobile Java General | 8 | 2008-05-01 11:24 |
| InConsistency in Uploading video files | kumar_sai123 | Symbian Networking & Messaging | 0 | 2007-11-08 11:14 |
| RecordEnumeration throwing null pointer exception | kralvarado | Mobile Java General | 2 | 2006-04-13 05:07 |