flutter_ringtone_player icon indicating copy to clipboard operation
flutter_ringtone_player copied to clipboard

volume and looping not working in my app

Open iPatel007 opened this issue 6 years ago • 7 comments

Actually I just set and I found that if I change volume 0.1 to 5 or any it doesn't reflect to sound and also I set looping: true but doesn't any reflect.

  `FlutterRingtonePlayer.play(android: AndroidSounds.notification, ios: IosSounds.triTone, volume: 0.1, looping: true);`

I checked with device and simulator too. both has same issue.

iPatel007 avatar Aug 03 '19 07:08 iPatel007

Are you testing this on iOS, if so please keep this line from README.md in mind:

You can also specify some additional parameters (works only on Android with API 28 and above):

As for now with play method being used here it's impossible to control anything on iOS.

SPodjasek avatar Aug 20 '19 21:08 SPodjasek

It's not working on my Sam Sung Note 9 @SPodjasek . On Simulator, it worked well. This is showing:

V/MediaPlayer-JNI( 4527): setVolume: left 0.000000  right 0.000000
V/MediaPlayerNative( 4527): MediaPlayer::setVolume(0.000000, 0.000000)
V/MediaPlayer-JNI( 4527): reset
V/MediaPlayerNative( 4527): reset
V/MediaPlayerNative( 4527): message received msg=8, ext1=0, ext2=0
V/MediaPlayerNative( 4527): notify(8, 0, 0) callback on disconnected mediaplayer
V/MediaPlayer( 4527): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer( 4527): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaPlayer( 4527): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer( 4527): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaPlayer-JNI( 4527): release
V/MediaPlayerNative( 4527): setListener
V/MediaPlayerNative( 4527): disconnect
V/MediaPlayerNative( 4527): destructor
V/MediaPlayerNative( 4527): disconnect
I/Ringtone( 4527): Change URI : content://settings/system/notification_sound to content://media/internal/audio/media/144, type : 2
V/MediaPlayer-JNI( 4527): native_setup
V/MediaPlayerNative( 4527): constructor
V/MediaPlayerNative( 4527): setListener
I/Ringtone( 4527): Internal uri : content://settings/system/notification_sound
D/RingtoneManager( 4527): getActualDefaultRingtoneUri  type    :2
D/RingtoneManager( 4527): Current soundfile is in internal storage
V/MediaPlayer-JNI( 4527): setDataSourceFD: fd 105
V/MediaPlayerNative( 4527): setDataSource(105, 0, 576460752303423487)
V/MediaPlayer-JNI( 4527): setVolume: left 0.000000  right 0.000000
V/MediaPlayerNative( 4527): MediaPlayer::setVolume(0.000000, 0.000000)
V/MediaPlayer-JNI( 4527): setAuxEffectSendLevel: level 0.000000
V/MediaPlayerNative( 4527): MediaPlayer::setAuxEffectSendLevel(0.000000)
V/MediaPlayer-JNI( 4527): setParameter: key 1400
V/MediaPlayerNative( 4527): MediaPlayer::setParameter(1400)
V/MediaPlayer-JNI( 4527): setVolume: left 0.000000  right 0.000000
V/MediaPlayerNative( 4527): MediaPlayer::setVolume(0.000000, 0.000000)
V/MediaPlayer-JNI( 4527): setLooping: 0
V/MediaPlayerNative( 4527): MediaPlayer::setLooping
V/MediaPlayerNative( 4527): setVideoSurfaceTexture
V/MediaPlayerNative( 4527): prepare
V/MediaPlayerNative( 4527): message received msg=200, ext1=10973, ext2=0
W/MediaPlayerNative( 4527): info/warning (10973, 0)
V/MediaPlayerNative( 4527): callback application
V/MediaPlayerNative( 4527): back from callback
V/MediaPlayerNative( 4527): message received msg=1, ext1=0, ext2=0
V/MediaPlayerNative( 4527): MediaPlayer::notify() prepared
V/MediaPlayerNative( 4527): signal application thread
V/MediaPlayerNative( 4527): callback application
V/MediaPlayerNative( 4527): back from callback
V/MediaPlayerNative( 4527): prepare complete - status=0
V/MediaPlayerNative( 4527): invoke 68
D/Ringtone( 4527): Successfully created local player
V/MediaPlayer-JNI( 4527): setVolume: left 0.000000  right 0.000000
V/MediaPlayerNative( 4527): MediaPlayer::setVolume(0.000000, 0.000000)
V/MediaPlayer-JNI( 4527): setLooping: 0
V/MediaPlayerNative( 4527): MediaPlayer::setLooping
V/MediaPlayerNative( 4527): setVideoSurfaceTexture
V/MediaPlayerNative( 4527): prepare
V/MediaPlayerNative( 4527): message received msg=200, ext1=10973, ext2=0
W/MediaPlayerNative( 4527): info/warning (10973, 0)
V/MediaPlayerNative( 4527): callback application
V/MediaPlayerNative( 4527): back from callback
V/MediaPlayerNative( 4527): message received msg=1, ext1=0, ext2=0
V/MediaPlayerNative( 4527): MediaPlayer::notify() prepared
V/MediaPlayerNative( 4527): signal application thread
V/MediaPlayerNative( 4527): callback application
V/MediaPlayerNative( 4527): back from callback
V/MediaPlayerNative( 4527): prepare complete - status=0
V/MediaPlayerNative( 4527): invoke 68

namnh06 avatar Oct 09 '19 04:10 namnh06

It doesn't work on Android too. I set looping: true but song for 6 ~ 7 s and stop.

biawar avatar Oct 24 '19 19:10 biawar

~~I've just checked on my phone, and it played well, many times in a loop. But suddenly, after some time, it stopped and gone silent since then. I'll have to investigate this issue further.~~

I've messed up my test code and FlutterRingtonePlayer.stop() was called instantly after playing, so no sound was played. After fixing this it works as expected. So I've tested and confirmed this plugin to work on:

  • [x] Mi A2
  • [x] Nexus 5X

I don't have any Samsung phones nearby to test, but I'll try to organize something soon...

SPodjasek avatar Oct 25 '19 13:10 SPodjasek

Have the same issue with the latest version 3.0.0 on iOS the ringtone wont loop.

vabym8 avatar Jun 01 '21 15:06 vabym8

I have the same issue on 3.2.0, sound plays once and does not loop. Any workaround?

class WaitingDriverResPanel extends ConsumerStatefulWidget {
  const WaitingDriverResPanel({Key? key}) : super(key: key);
  @override
  _WaitingDriverResPanelState createState() => _WaitingDriverResPanelState();
}

class _WaitingDriverResPanelState extends ConsumerState<WaitingDriverResPanel> {
  @override
  void initState() {
    super.initState();
    //it plays once only
    FlutterRingtonePlayer.play(
        fromAsset: "assets/direct_request_tune.mp3", looping: true);
    //also this one, plays once
    FlutterRingtonePlayer.playRingtone();
  }

  @override
  void dispose() {
    super.dispose();
    FlutterRingtonePlayer.stop();
  }

  @override
  Widget build(BuildContext context) {
    return Align(
      alignment: Alignment.center,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          const Text('Waiting for driver response'),
          const SizedBox(height: 20),
          const Text('Tap to cancel'),
          ElevatedButton(
            onPressed: () {
              ref.read(driverScreenStateProvider.notifier).screen =
                  DriverScreenState.none;
            },
            child: const Text('Cancel'),
          ),
        ],
      ),
    );
  }
}

SamiAlsubhi avatar Aug 30 '22 07:08 SamiAlsubhi

Yeah me too, the loop: true doesn't seem to work for me either, This is really urgent as my PM won't lemme rest, Plus I didn't get any error on the terminal regarding this. Thanks in advance

mathiasgodwin avatar Sep 22 '22 10:09 mathiasgodwin

Hey, anyone found solution for this ? For me as well. looping in iOS device not working.

Loop not working for me on iOS either. It's fine on Android though. Any updates on this?

steveneal avatar Jan 18 '23 20:01 steveneal

This issue has stalled.

github-actions[bot] avatar Jul 18 '23 00:07 github-actions[bot]

This issue has been closed due to inactivity.

github-actions[bot] avatar Aug 18 '23 00:08 github-actions[bot]