blob: 285b49118373dc5750ec960a9028de7043ca6e98 [file] [log] [blame]
Test for metadata tracks from Apple HLS stream.
** Set video.src, wait for media data to load
RUN(video.src = 'http://127.0.0.1:8000/media/resources/hls/metadata/prog_index.m3u8')
EVENT(addtrack)
EXPECTED (tracks.length == '1') OK
RUN(track = video.textTracks[0])
EXPECTED (track.kind == 'metadata') OK
EXPECTED (track.mode == 'disabled') OK
RUN(track.mode = 'hidden')
EVENT(canplaythrough)
** Start playback, wait for all cues to load
RUN(video.play())
** Validate cue data
* 1
EXPECTED (typeof(cue) != 'undefined') OK
EXPECTED (cue.data == 'null') OK
EXPECTED (cue.type == 'com.apple.quicktime.HLS') OK
EXPECTED (cue.value != 'null') OK
EXPECTED (cue.value.key == '"X-START-OFFSET"') OK
EXPECTED (cue.value.data == '"0.000000"') OK
* 2
EXPECTED (typeof(cue) != 'undefined') OK
EXPECTED (cue.data == 'null') OK
EXPECTED (cue.type == 'com.apple.quicktime.HLS') OK
EXPECTED (cue.value != 'null') OK
EXPECTED (cue.value.key == '"X-END-OFFSET"') OK
EXPECTED (cue.value.data == '"5.000000"') OK
* 3
EXPECTED (typeof(cue) != 'undefined') OK
EXPECTED (cue.data == 'null') OK
EXPECTED (cue.type == 'org.id3') OK
EXPECTED (cue.value != 'null') OK
EXPECTED (cue.value.key == '"TIT2"') OK
EXPECTED (cue.value.data == '"Stream Counting"') OK
* 4
EXPECTED (typeof(cue) != 'undefined') OK
EXPECTED (cue.data == 'null') OK
EXPECTED (cue.type == 'org.id3') OK
EXPECTED (cue.value != 'null') OK
EXPECTED (cue.value.key == '"TPE1"') OK
EXPECTED (cue.value.data == '"Andy"') OK
* 5
EXPECTED (typeof(cue) != 'undefined') OK
EXPECTED (cue.data == 'null') OK
EXPECTED (cue.type == 'org.id3') OK
EXPECTED (cue.value != 'null') OK
EXPECTED (cue.value.key == '"TALB"') OK
EXPECTED (cue.value.data == '"Greatest Hits"') OK
* 6
EXPECTED (typeof(cue) != 'undefined') OK
EXPECTED (cue.data == 'null') OK
EXPECTED (cue.type == 'org.id3') OK
EXPECTED (cue.value != 'null') OK
EXPECTED (cue.value.key == '"GEOB"') OK
EXPECTED (cue.value.data == '{}') OK
EXPECTED (cue.value.type == '"image/png"') OK
EXPECTED (cue.value.info == '"Our Hero"') OK
EXPECTED (cue.value.name == '"abe.png"') OK
* 7
EXPECTED (typeof(cue) != 'undefined') OK
EXPECTED (cue.data == 'null') OK
EXPECTED (cue.type == 'org.id3') OK
EXPECTED (cue.value != 'null') OK
EXPECTED (cue.value.key == '"APIC"') OK
EXPECTED (cue.value.data == '{}') OK
EXPECTED (cue.value.type == '"image/png"') OK
* 8
EXPECTED (typeof(cue) != 'undefined') OK
EXPECTED (cue.data == 'null') OK
EXPECTED (cue.type == 'org.id3') OK
EXPECTED (cue.value != 'null') OK
EXPECTED (cue.value.key == '"TXXX"') OK
EXPECTED (cue.value.data == '"Text Blob"') OK
** Extract images from cue data, validate by setting img.src
RUN(cueImageData = track.cues[5].value.data)
EXPECTED (cueImageData instanceof ArrayBuffer == 'true') OK
RUN(blobUrl = URL.createObjectURL(new Blob([cueImageData], { type: 'image/png' })))
RUN(imageElement.src = blobUrl)
EVENT(load)
EXPECTED (imageElement.width == '76') OK
EXPECTED (imageElement.height == '103') OK
RUN(cueImageData = track.cues[6].value.data)
EXPECTED (cueImageData instanceof ArrayBuffer == 'true') OK
RUN(blobUrl = URL.createObjectURL(new Blob([cueImageData], { type: 'image/png' })))
RUN(imageElement.src = blobUrl)
EVENT(load)
EXPECTED (imageElement.width == '100') OK
EXPECTED (imageElement.height == '100') OK
END OF TEST