problem in play media file

Put your problem here if it does not fit any of the other categories.

problem in play media file

Postby rmeph » Tue Feb 19, 2008 1:53 pm

i want play audio file on emulator...actually i have zip folder in raw folder...i got all zip file in ZipInputStream....that why i have not id of audio file....and not url..then how to play audio file :( im use m5 new sdk......
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Postby plusminus » Tue Feb 19, 2008 8:24 pm

Hello rmeph,

I know no good workaround...
the search for any method that takes an input-stream.
Or extract the file to a temporary location and play it from there.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby rmeph » Wed Feb 20, 2008 3:39 pm

thanks for reply..is possible to other way......
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby rmeph » Thu Feb 21, 2008 4:17 pm

plusminus wrote:Hello rmeph,

I know no good workaround...
the search for any method that takes an input-stream.
Or extract the file to a temporary location and play it from there.

Regards,
plusminus


when extract file to a temporary location
i used code
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.   void writeFile(String filename) {
  2.                   InputStream is = pr.getResources().openRawResource(R.raw.data);
  3.                     ZipInputStream zis = new ZipInputStream(is);
  4.                     ZipEntry ze;
  5.                     String dataDir = getFileStreamPath("").getAbsolutePath()+"/";
  6.                       try {
  7.                                 while ((ze = zis.getNextEntry()) != null) {
  8.  if (ze.getName().trim().equals(filename.trim()))
  9.                                         {
  10.  
  11.                                 OutputStream os = null;
  12.                                     os = new FileOutputStream(path);
  13.                                         while ((read = is.read(buffer)) > 0) {
  14.                                               os.write(buffer, 0, read);
  15.                                             }
  16.                                         }
  17.                                 }
  18.                         } catch (FileNotFoundException e) {
  19.                         e.printStackTrace();
  20.                         } catch (IOException e) {
  21.                         e.printStackTrace();
  22.                         }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


but it's show error


DEBUG/dalvikvm(683): Exception Ljava/lang/ClassNotFoundException; from PathClassLoader.java:205 not caught locally

DEBUG/dalvikvm(683): NOTE: loadClass 'org.apache.harmony.archive.internal.nls.messages' 0x40018950 threw an exception


how to stroted file in temporary location??
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 20 guests