×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    10

    Please help to play the voice received in J2me player

    Hi all,
    I am developing an application using j2me. I had developed a code to receive the voice using the datagram and play it using the player

    This is the code to play the voice received using datagram

    Code:
    DatagramConnection dc = null;
                Datagram dgram;
                String datagramAddress = "";            
          try 
          {          
            // Open Server side datagram connection
              datagramAddress = "datagram://"+theIp+":"+thePort;
           
              dc = (DatagramConnection)Connector.open(datagramAddress);          
              while (true) 
              {                           
                  dgram = dc.newDatagram(100);              
                  ByteArrayInputStream recordedInputStream = 
                       new ByteArrayInputStream(dgram.getData());
                  Player p2 = Manager.createPlayer(recordedInputStream, "audio/x-wav");
                  
                  p2.realize();
                                
                  p2.prefetch();              
                  p2.start();                            
               }
              }          
              catch (Exception e)
              {
                  e.printStackTrace();
                  form.append(e.getMessage());
                System.out.println("Exception doReceive(): " + e.getMessage());
              }
           finally {
              if (dc != null) {
              try {
                           dc.close();
                       }
                       catch (Exception e) {
                          System.out.println("Exception Closing: " + e.getMessage());
                       }
                   }
              }
    When I run this code, I am getting the following error

    Code:
    Uncaught exception java/lang/RuntimeException: IOException reading reader invalid first byte 10000000.
    javax.microedition.media.MediaException: Failed to realize Player: Malformed wave media: expected 'RIFF'
            at com.sun.mmedia.WavPlayer.doRealize(WavPlayer.java:243)
            at com.sun.mmedia.BasicPlayer.realize(BasicPlayer.java:519)
            at Tools.doReceive(Tools.java:124)
            at SipCallDemo.notifyResponse(SipCallDemo.java:327)
            at gov.nist.microedition.sip.SipClientConnectionImpl.notifyResponseReceived(+230)
            at gov.nist.microedition.sip.StackConnector.processResponse(StackConnector.java:575)
            at gov.nist.siplite.EventScanner.run(EventScanner.java:226)
    Please help me to solve this problem. Please guide me to the correct path if I am wrong.

    If my information is insufficient, please correct me.

    Thanks in advance,
    Girish
    Last edited by girish_m.v; 2010-06-18 at 08:20.

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Please help to play the voice received in J2me player

    check the voice data format - you are trying to play audio/x-wav, in VoIP we generally used some compressed voice data formats.
    Thanks,
    Ekta

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    10

    Re: Please help to play the voice received in J2me player

    Thanks for your reply. I will work with it and get back if I have problems.

Similar Threads

  1. Replies: 0
    Last Post: 2009-10-28, 18:03
  2. J2ME concurrent voice data processing and voice recording
    By seshu_tolety in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2009-02-04, 01:51
  3. J2ME Concurrent voice data processing and voice recording
    By seshu_tolety in forum Streaming and Video
    Replies: 0
    Last Post: 2009-02-02, 03:41
  4. Replies: 0
    Last Post: 2008-06-18, 20:30

Posting Permissions

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