Visualizzazione post con etichetta lg. Mostra tutti i post
Visualizzazione post con etichetta lg. Mostra tutti i post

lunedì 29 novembre 1999

LG KE970 Shine bug using MediaPlayer and setVolume

If you want to set the volume in the MediaPlayer using the following code:



                InputStream is = getClass().getResourceAsStream( "/sound.amr" );

                Player player = Manager.createPlayer(is, soundType);

               
player.addPlayerListener( this );

               
player.realize();

                VolumeControl volumeControl =

                (VolumeControl)
player .getControl( "VolumeControl" );

                if ( volumeControl != null ) {

                    volumeControl.setLevel( volume );

                }



when you launch the player with:



                player.start();



no sound can be heard on the LG KE970 Shine without getting any error.



This device requires to get the prefetched status if you want to set the volume and play the sound correctly. The working code is then:





                InputStream is = getClass().getResourceAsStream( "/sound.amr" );

                Player player = Manager.createPlayer(is, soundType);

               
player.addPlayerListener( this );

               
player.realize();

               
player.prefetch( );

                VolumeControl volumeControl =

                (VolumeControl)
player .getControl( "VolumeControl" );

                if ( volumeControl != null ) {

                    volumeControl.setLevel( volume );

                }




Maybe other phones are affected as well (especially LG). Post comment if you other phones with the same problem.

J2ME: the LG Developer site

Finally also LG has his own developer site where we can find documentation, emulators and SDK. Their phones were some of the most misterious devices on the market for the developers.

To see the new developer site click here

LgDeveloper