SmilParallel.fromXmlElement constructor

SmilParallel.fromXmlElement(
  1. XmlElement xml
)

Creates a SmilParallel from a

Implementation

factory SmilParallel.fromXmlElement(XmlElement xml) {
  final audioNode = xml.xpath('audio').first;
  final textNode = xml.xpath('text').first;
  return SmilParallel(
    id: xml.getAttribute('id')!,
    clipBegin: const Duration().fromString(
      audioNode.getAttribute('clipBegin')!,
    ),
    clipEnd: const Duration().fromString(
      audioNode.getAttribute('clipEnd')!,
    ),
    textFileName: textNode.getAttribute('src')!.split('#').first,
    textId: textNode.getAttribute('src')!.split('#').last,
  );
}