New issue
Advanced search Search tips

Issue 737583 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Jun 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

RemoveCue failes with a VVTCue object, expects TextTrackCue instead

Reported by pdca...@gmail.com, Jun 28 2017

Issue description

Chrome Version       : 58.0.3029.110
OS Version: 10.0
URLs (if applicable) :
Other browsers tested:
  Add OK or FAIL after other browsers where you have tested this issue:
     Safari 5:
  Firefox 4.x:
     IE 7/8/9:

What steps will reproduce the problem?

-- HTML
       <video id="brightplayer-video" 
                             class="responsive-video"  src="http://www.w3schools.com/html/mov_bbb.mp4" controls="controls" style="margin: auto; height: 100%; width: 100%; max-height:400px;"></video>

-- JS
  var currentPlayer = document.getElementById("brightplayer-video");
                    
                    var textTracks = currentPlayer.textTracks; // one for each track element

// If track element doesn't exist, add it the first time this is called...
                    if(textTracks.length == 0) { 
                        var track = currentPlayer.addTextTrack("captions", "English", "en");

                        track.addCue(new VTTCue(0, 2, "[Test]"));
                        track.addCue(new VTTCue(4, 7, "This blade has a dark past."));
                        track.addCue(new VTTCue(9, 11, "It has shed much innocent blood."));
                    }
                    else {
// if track already exists, clear out the cues to reload with new cues....
                        var currentTracks = currentPlayer.textTracks; // one for each track element
                        var textTrack = currentTracks[0]; // corresponds to the first track element
                        var cues = textTrack.cues;
                        for (var i = cues.length; i >= 0; i--) {
                            textTrack.removeCue(cues[i]); // error occurs here
                        }
                        textTrack.addCue(new VTTCue(0, 2, "[Test2]"));
                        textTrack.addCue(new VTTCue(4, 7, "This blade has a dark past.2"));
                        textTrack.addCue(new VTTCue(9, 11, "It has shed much innocent blood.2"));
                    }

What is the expected result?
The cues would be removed.

What happens instead of that?
Exception : Failed to execute 'removeCue' on 'TextTrack': parameter 1 is not of type 'TextTrackCue'.

Please provide any additional information below. Attach a screenshot if
possible.

UserAgentString: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36



 

Comment 1 by f...@opera.com, Jun 28 2017

I think you have a bug in your iteration statement:

  for (var i = cues.length; i >= 0; i--)

cues[cues.length] (i.e i == cues.length) will not return a VTTCue.

Use:

  for (var i = cues.length - 1; i >= 0; i--)

instead?

Comment 2 by f...@opera.com, Jun 28 2017

Components: Blink>Media>Track

Comment 3 by pdca...@gmail.com, Jun 28 2017

Well, I feel stupid.  Thanks!

Comment 4 by f...@opera.com, Jun 28 2017

Status: WontFix (was: Unconfirmed)
No problem.

Sign in to add a comment