openPlayer method

  1. @override
Future<int> openPlayer(
  1. TauPlayerCallback callback, {
  2. required Level logLevel,
  3. AudioFocus? focus,
  4. SessionCategory? category,
  5. SessionMode? mode,
  6. int? audioFlags,
  7. AudioDevice? device,
  8. bool? withUI,
})
override

Implementation

@override
Future<int> openPlayer(TauPlayerCallback callback, {required Level logLevel, AudioFocus? focus, SessionCategory? category, SessionMode? mode, int? audioFlags, AudioDevice? device, bool? withUI}) async
{
        // openAudioSessionCompleter = new Completer<bool>();
        // await invokeMethod( callback, 'initializeMediaPlayer', {'focus': focus.index, 'category': category.index, 'mode': mode.index, 'audioFlags': audioFlags, 'device': device.index, 'withUI': withUI ? 1 : 0 ,},) ;
        // return  openAudioSessionCompleter.future ;
        int slotno = findSession(callback);
        TauCorePlayer player = newPlayerInstance(callback, callbackTable);// TauCorePlayer(callback, callbackTable);
        if (slotno < _slots.length)
        {
                assert (_slots[slotno] == null);
                _slots[slotno] = player;
        } else
        {
                assert(slotno == _slots.length);
                _slots.add( player);
        }

        return _slots[slotno]!.initializeMediaPlayer( focus!.index,  category!.index, mode!.index, audioFlags, device!.index, withUI);
}