openPlayer method
Future<int>
openPlayer(
- TauPlayerCallback callback, {
- required Level logLevel,
- AudioFocus? focus,
- SessionCategory? category,
- SessionMode? mode,
- int? audioFlags,
- AudioDevice? device,
- 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);
}