startPlayStream method

Future<ZegoStreamInfo> startPlayStream(
  1. String streamID
)

Implementation

Future<ZegoStreamInfo> startPlayStream(String streamID) async {
  final index = playingStreamListNotifier.value.indexWhere(
    (e) => e.streamID == streamID,
  );
  if (-1 != index &&
      playingStreamListNotifier.value[index].stateNotifier.value !=
          ZegoPlayerState.NoPlay) {
    await stopPlayStream(streamID);
  }

  var streamInfo = ZegoStreamInfo.empty();
  streamInfo.streamID = streamID;
  final newList = List<ZegoStreamInfo>.from(playingStreamListNotifier.value);
  newList.add(streamInfo);
  playingStreamListNotifier.value = newList;

  await _startPlayStream(streamInfo);
  await _updateCanvas(streamInfo);

  return streamInfo;
}