create static method
Future<NELivePlayer>
create({
- void onPreparedListener()?,
- void onCompletionListener()?,
- void onErrorListener(
- PlayerErrorType what,
- int extra
- void onVideoSizeChangedListener()?,
- void onReleasedListener()?,
- void onLoadStateChangeListener(
- PlayStateType type,
- int extra
- void onFirstVideoDisplayListener()?,
- void onFirstAudioDisplayListener()?,
创建播放器实例 Create a player instance
Implementation
static Future<NELivePlayer> create({
void Function()? onPreparedListener,
void Function()? onCompletionListener,
void Function(PlayerErrorType what, int extra)? onErrorListener,
void Function(int width, int height)? onVideoSizeChangedListener,
void Function()? onReleasedListener,
void Function(PlayStateType type, int extra)? onLoadStateChangeListener,
void Function()? onFirstVideoDisplayListener,
void Function()? onFirstAudioDisplayListener,
}) {
return NeliveplayerPlatform.instance.create().then((value) {
String playerId;
String? textureId;
if (Platform.isIOS) {
playerId = value;
} else if (Platform.isAndroid) {
List<String> ids = value.split('+');
playerId = ids.first;
textureId = ids.last;
} else {
playerId = '';
}
return NELivePlayer._(playerId,
textureIdAndroid: textureId,
onPreparedListener: onPreparedListener,
onCompletionListener: onCompletionListener,
onErrorListener: onErrorListener,
onVideoSizeChangedListener: onVideoSizeChangedListener,
onReleasedListener: onReleasedListener,
onLoadStateChangeListener: onLoadStateChangeListener,
onFirstAudioDisplayListener: onFirstAudioDisplayListener,
onFirstVideoDisplayListener: onFirstVideoDisplayListener);
});
}