×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Nov 2004
    Location
    Rome (Italy)
    Posts
    24

    Sound recording on emulator

    I receive always this exception: "javax.microedition.media.MediaException: Cannot create a DataSource for: capture://audio" while attempting to record a sound with SDK Emulator.
    I don't understand why SDK emulator doesn't start audio recording. If you read on file Nokia_Prototype_SDK_UsersGuide.pdf at page 38, it says that audio recording is supported by emulator using a working microphone on PC.

  2. #2
    Registered User
    Join Date
    Mar 2007
    Posts
    46

    Smile Re: Sound recording on emulator

    I meet the same problem,each time i want to record a audio,then there is a error says:"Player cannot be created for capture://audio
    at javax.microedition.media.Manager.createPlayer(+191)"
    I am confusing about it.if you have any method to work out,please tell me,tkz.

  3. #3
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,430

    Re: Sound recording on emulator

    I have posted some code here for recording audio. Please go through this thread.
    http://discussion.forum.nokia.com/fo...370#post288370

    Regards
    Gopal

    __________________
    MobiQuil.com
    An initiative by Developers for Developers.
    http://www.mobiquil.com - Alpha - Launched.

  4. #4
    Registered User
    Join Date
    Mar 2007
    Posts
    46

    Re: Sound recording on emulator

    Thank you for you help, I have tested the codes. When I use the SUN WTK, it can creat player to capture audio, but when I use sony ericsson emulator,there comes the error that I can't still capture the audio,I don't know why....

  5. #5
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Bangalore, India
    Posts
    100

    Re: Sound recording on emulator

    Quote Originally Posted by gordon32
    Thank you for you help, I have tested the codes. When I use the SUN WTK, it can creat player to capture audio, but when I use sony ericsson emulator,there comes the error that I can't still capture the audio,I don't know why....
    The problem with SonyEricsson Emulator is that sony Emulators dont support Audio Recording, only real phones do. You can see the reply from my thread given below from the Sony Development Team
    http://developer.sonyericsson.com/th...8301&tstart=31
    with regards,
    Khalandar Pasha N
    (khalandar_p@yahoo.co.in)

  6. #6
    Registered User
    Join Date
    Mar 2007
    Posts
    46

    Re: Sound recording on emulator

    Hi
    When I change my emulator to SUN WTK, the audio is ok.Here is the codes,hoping it helpful for others....
    Code:
    package record.audio;
    
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.media.*;
    import javax.microedition.media.control.*;
    import java.io.*;
    import javax.microedition.io.file.*;
    import javax.microedition.io.*;
    public class RecordAudio extends MIDlet {
    	Player player1, player2;
    	ByteArrayOutputStream bos;
    	ByteArrayInputStream bis;
    	RecordControl rc;
    	FileConnection fconn;
    	DataOutputStream dos;
    	DataInputStream dis;
    	
    	public RecordAudio() {
    		
    	}
    
    	protected void destroyApp(boolean arg0)  {
    
    	}
    
    	protected void pauseApp() {
    
    	}
    
    	protected void startApp()  {
    		try{
    			
    			try {
    			     fconn = (FileConnection)Connector.open("file:///root1/newfile.wav");
    			     // If no exception is thrown, then the URI is valid, but the file may or may not exist.
    			     if (!fconn.exists())
    			     {
    			    	 fconn.create();  // create the file if it doesn't exist
    			    	 System.out.println("FILE Exist");
    			     }
    
    			     //fconn.close();
    			 }
    			 catch (IOException ioe) {
    				 ioe.printStackTrace();
    			 }
    			 
    			 
    			try{
    				player1 = Manager.createPlayer("capture://audio");
    			}catch(Exception e){
    				System.out.println("creat error");
    				e.printStackTrace();
    			}
    			System.out.println("After CREAT");
    			player1.realize();
    			
    			try{
    				rc = (RecordControl) player1.getControl("RecordControl");
    			}catch(Exception e){
    				System.out.println("RecordControl error");
    				e.printStackTrace();
    			}
    			
    			bos = new ByteArrayOutputStream();
    			
    			try{
    				rc.setRecordStream(bos);
    			}catch(Exception e){
    				System.out.println("rc.setRecordStream(bos) error");
    			}
    			
    	
    			player1.prefetch();
    			
    			try {
    				rc.startRecord();
    			} catch (Exception e) {
    				e.getMessage();
    			}
    			
    			player1.start();
    			Thread.sleep(10000);
    			
    			try {
    				rc.commit();
    			} catch (Exception e) {
    				e.getMessage();
    			}
    			
    			player1.close();
    			System.out.println("After CLOSE");
    			
    			try{
    				dos = fconn.openDataOutputStream();
    				dos.write(bos.toByteArray());
    				dos.flush();
    				dos.close();
    				fconn.close();
    	    	}catch(Exception e){
    				e.printStackTrace();
    				System.out.println("dos error");
    			}
    			
    			System.out.println("After Save Before Open");
    			
    	    	try{
    	    		fconn = (FileConnection)Connector.open("file:///root1/newfile.wav");
    	    		if(fconn.exists())
    	    			System.out.println("Open");
    	    		
    	    		dis = fconn.openDataInputStream();
    	    	}catch(Exception e){
    	    		e.printStackTrace();
    	    	}
    	    	
    	    	try{
    	    		player2 = Manager.createPlayer(dis, "audio/x-wav");
    	    	}catch(Exception e){
    	    		e.printStackTrace();
    	    	}
    			
    			System.out.println("After CREAT player2");
    			try{
    				player2.realize();
    			}catch(Exception e){
    				System.out.println("******");
    				e.printStackTrace();
    				e.getMessage();
    				System.out.println("*******");
    			}
    			try{
    				player2.prefetch();
    				player2.start();
    			}catch(Exception e){
    				e.printStackTrace();
    			}
    			
    			System.out.println("The end!!");
    		}catch(Exception e){
    			e.printStackTrace();
    		}
    
    	}
    
    }

Similar Threads

  1. Sound recording - N70
    By dakz in forum Mobile Java General
    Replies: 13
    Last Post: 2007-02-24, 11:01
  2. S60 emulator for audio recording
    By ajaybrar in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-06-13, 16:00
  3. Playing Sound on Emulator
    By DavidHSR in forum Symbian Tools & SDKs
    Replies: 3
    Last Post: 2006-05-10, 21:55
  4. help with sound recording and playing
    By walterzcm in forum Mobile Java General
    Replies: 1
    Last Post: 2002-11-06, 11:42
  5. does series 60 emulator support sound?
    By kelkel in forum Mobile Java Tools & SDKs
    Replies: 3
    Last Post: 2002-07-03, 08:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •