A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/apis/audio-video/TextTrackCue/getCueAsHTML below:

getCueAsHTML · WebPlatform Docs

getCueAsHTML Summary

Returns the text track cue text as a DocumentFragment of HTML elements and other DOM nodes.

Method of apis/audio-video/TextTrackCueapis/audio-video/TextTrackCue

Syntax
var object = TextTrackCue.getCueAsHTML();
Return Value

Returns an object of type DOM NodeDOM Node

DocumentFragment: A document fragment that represents the TextTrackCue text.

Examples

The HTML nodes replace the span element that is the first child of the div.

<head>
<script type="text/javascript">
    document.addEventListener("DOMContentLoaded", function () {  
      var track = document.getElementById("track1");
      track.addEventListener("cuechange", function () {
        var myTrack = this.track;             
        var myCues = myTrack.activeCues;      
        if (myCues.length > 0) {
          var disp = document.getElementById("display");
          disp.replaceChild((myCues[0].getCueAsHTML()), disp.firstChild);
        }
      }, false);
    }, false);
    </script>
  </head>
  <body>
    <video id="video1" controls>
      <source src="video.mp4"  >
      <track id='track1' label='English captions' src="entrack.vtt" kind='subtitles' srclang='en' default >
    </video>
    <div id="display">
      
    </div>
Related specifications
W3C HTML5 Specification
W3C Editor’s Draft
Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4