• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

A Video Player

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to play a video that is packaged with the jar file?
How can it be done?
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you can do it using the Class.getResourceAsStream method. It gets a resource (audio, video,...) from jar file.
Then you can use the InputStream for the Player.

For instance:
InputStream is = getClass().getResourceAsStream("myvideo.mpg");
Player player = Manager.createPlayer( is, "video/mpg" );

For some examples take a look at TechDays from Sun:
http://developers.sun.com/events/techdays/presentations/hyderabad/MIDP2.0-DevWirelessApps-Hyderabad.pdf

and at forum.nokia.com:
http://www.forum.nokia.com/main/1,6566,21,00.html?fsrParam=1-3-/main/1,6566,21_10,00.html&fileID=2777

Ed
 
Ian Strain
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That didn't work.
I got this error:
Media Exception error: Cannot create a Player for: video/mpg
 
Ed Schepis
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends on the device you are using. Not all the devices implement mpeg format (i.e. Nokia use 3gp format).
But in emulator must work with mpeg.
 
Ian Strain
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using an emulator, WTK22 beta version and it doesn't work
 
Ed Schepis
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... sorry that's my fault... use "video/mpeg" content type instead of "video/mpg"... that was a typo.
 
Ian Strain
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've tried that already too but still no joy
 
Ed Schepis
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you want post some snippet of your code?
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic