What is the proper way to read the video elements/attributes in video.js?
<p>I needed to read and then modify some of the tags and attributes in the video element, which uses video.js as its player. I have been able to read the information using getElementsByTagName and getAttribute, as shown in the code below.  But I was hoping there was an easier/better/best way to do this through video.js (5.6.0).</p>

<pre><code>var video = document.getElementsByTagName('video')[0];
var poster = video.getAttribute('poster');
var sources = video.getElementsByTagName('source');
var tracks = video.getElementsByTagName('track');

if (poster != null)
{
    var newposter = addChk(poster, "p");  // generates modified source
    video.setAttribute('poster', newposter);
}

for (var i = 0; i &lt; sources.length; i++) {
    var s = sources[i].getAttribute('src');
    s = addChk(s,"f");                    // generates modified source
    sources[i].setAttribute('src', s);
}

for (var i = 0; i &lt; tracks.length; i++)
{
    var s = tracks[i].getAttribute('src');
    s = addChk(s, "c");                   // generates modified source
    tracks[i].setAttribute('src', s);
}
</code></pre>

<p>Thanks.</p>