setSubtitle method

  1. @override
void setSubtitle(
  1. ByteArkPlayerMediaTrack? track
)
override

Sets the active subtitle. Pass null to disable subtitles.

Implementation

@override
void setSubtitle(ByteArkPlayerMediaTrack? track) =>
    _withPlayer('setSubtitle', (p) {
      // Passing `null` here means "disable all subtitles" — the helper
      // sees a null targetId, never marks any track as active, and the
      // iteration disables every text track.
      _activateJsTrack(
        p,
        listMethod: 'textTracks',
        targetId: track?.id,
        activeProperty: 'mode',
        activeValue: 'showing'.toJS,
        inactiveValue: 'disabled'.toJS,
      );
    });