render method

  1. @override
HTMLAudioElement render()
override

Creates an HTML Element represention of Component.

Implementation

@override
HTMLAudioElement render() {
  final element = super.render() as HTMLAudioElement;
  controller?.media = element;

  if (autoPlay) {
    element.setAttribute("autoplay", "true");
  }

  if (loop) {
    element.setAttribute("loop", "true");
  }

  if (muted) {
    element.setAttribute("muted", "true");
  }

  if (playsInline) {
    element.setAttribute("playsinline", "true");
  }

  if (showControls) {
    element.setAttribute("controls", "true");
  }

  element.setAttribute(
      "controlslist", controls!.map((control) => control.name).join(" "));

  return element;
}