inway / flutter_ringtone_player

Simple Flutter plugin to play ringtone, alarm & notification sounds
MIT License
92 stars 57 forks source link

volume and looping not working in my app #2

Closed iPatel007 closed 1 year ago

iPatel007 commented 5 years ago

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.

SPodjasek commented 5 years ago

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.

namnh06 commented 4 years ago

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
biawar commented 4 years ago

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

SPodjasek commented 4 years ago

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:

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

vabym8 commented 3 years ago

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

SamiAlsubhi commented 2 years ago

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'),
          ),
        ],
      ),
    );
  }
}
mathiasgodwin commented 2 years ago

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

shrutika-tatkare-apptware commented 1 year ago

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

steveneal commented 1 year ago

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

github-actions[bot] commented 1 year ago

This issue has stalled.

github-actions[bot] commented 1 year ago

This issue has been closed due to inactivity.