0

どのように私はそれを実現することができますか?VideoView は正常に動作していますが、soundPool から音が出ません。

  soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 100);
            soundsMap = new HashMap<Integer, Integer>();
                soundsMap.put(SOUND1, soundPool.load(this, R.raw.water1, 1));
                soundsMap.put(SOUND2, soundPool.load(this, R.raw.water2, 1));


            AudioManager mgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE);

                float streamVolumeCurrent = mgr.getStreamVolume(AudioManager.STREAM_MUSIC);
                float streamVolumeMax = mgr.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
                float volume = streamVolumeCurrent / streamVolumeMax;  

            soundPool.play(SOUND1, volume, volume, 1, 0, 1);
            .
            .
            .
            VideoView.start();
4

1 に答える 1

0
soundPool.play(SOUND1, volume, volume, 1, 0, 1);

上記のコードの代わりにこれを試してください

soundPool.play(soundsMap.get(SOUND1), volume, volume, 1, 0, 1);

マップを使用してすべての音楽ファイルを保存していると思います

于 2012-10-30T16:41:21.433 に答える