Playing Audio stream No sound played !

15 views
Skip to first unread message

fromyo...@gmail.com

unread,
Feb 10, 2019, 9:53:59 PM2/10/19
to CodenameOne Discussions
My Code the stream play in web browser not in app even I tried to play by method after that is print playing 
Issue 1) I couldn't set Icon even I set Icon it was now displayed
           2) There is no sound played , I tried in simulator and actual Android device No sound...  

////////////////////////////////////////
Media audio = MediaManager.createMedia("http://station.voscast.com/5c4758698ef40/", true);
      //  audio.prepare();
     
        Display.getInstance().callSerially(() -> {
            final MediaPlayer player = new MediaPlayer(audio);
            player.setAutoplay(true);
            
           try{ 
                     
    image1 =Image.createImage("/"+"Play.png");
      im =Image.createImage("/"+"Pouse.png");
    
           }catch(Exception ee){ee.printStackTrace();}
 image1=image1.scaled((400),(400));
           
            audio.setVolume(100);
            
            
             audio.play();
             
             
              audio.setVolume(100);
             
             
               System.out.println("Volume ? "+ audio.getVolume());
            
           System.out.println("Is playing ? "+ audio.isPlaying());
          
            player.setPlayIcon(image1.scaled((50),(50)));
            
              player.setPlayIcon(im.scaled((50),(50)));
            
            audio.setNativePlayerMode(false);
            radio.add(BorderLayout.CENTER, player);
            radio.revalidate();
///////////////////////

It Displaying just a progress bar , That's it nothing Else.. Please assist me it's very urgent...

Shai Almog

unread,
Feb 10, 2019, 10:33:57 PM2/10/19
to CodenameOne Discussions
Most native media players won't play a radio stream "as is". Web radio streams are encoded slightly differently as far as I know. Also this doesn't seem like the correct URL to the stream, it looks like the URL to the HTML that would play the stream.

Sathyaseelan Anton Arulvannan

unread,
Feb 11, 2019, 12:23:13 AM2/11/19
to codenameone...@googlegroups.com
Got it , Thanks.

On Mon, Feb 11, 2019 at 9:04 AM Shai Almog <shai....@gmail.com> wrote:
Most native media players won't play a radio stream "as is". Web radio streams are encoded slightly differently as far as I know. Also this doesn't seem like the correct URL to the stream, it looks like the URL to the HTML that would play the stream.

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/2xB7cenl7G8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/aa6a7fdc-2771-4414-9894-7d3e06179bd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages