# Media Source Extensions: mse-basic.html appends a clip to one SourceBuffer in 32 KiB
# chunks, ends the stream and plays; ?split uses separate video and audio SourceBuffers. Passes when
# MediaSource exists, every chunk is appended, and currentTime advances. Then mse-spec.html runs the spec
# cases one by one (see its header); each must report true. Offline, pages from a loopback server (WebKit rejects MSE blob URLs on file:// pages): python3 -m http.server 8765 --bind 127.0.0.1 --directory tests/smoke/pages &  then tools/smoke.sh.
wait 3
open http://127.0.0.1:8765/mse-basic.html
waitload 30
assert typeof MediaSource === 'function'
waitfor 20 window.mse && window.mse.stage === 'ended'
waitfor 20 window.mse.time > 1.5
shot mse-mp4
assert window.mse.errors.length === 0
js JSON.stringify(window.mse)
open http://127.0.0.1:8765/mse-basic.html?webm
waitload 30
waitfor 20 window.mse && window.mse.stage === 'ended'
waitfor 20 window.mse.time > 1.5
shot mse-webm
assert window.mse.errors.length === 0
js JSON.stringify(window.mse)
# Separate video and audio SourceBuffers (video appended 2 s before audio), as YouTube does
open http://127.0.0.1:8765/mse-basic.html?split
waitload 30
assert window.mse.supported === true
waitfor 30 window.mse && window.mse.stage === 'ended'
waitfor 20 window.mse.time > 1.5
assert window.mse.videoWidth > 0
shot mse-split
assert window.mse.errors.length === 0
js JSON.stringify(window.mse)
# Spec cases
open http://127.0.0.1:8765/mse-spec.html
waitload 30
waitfor 120 window.spec && window.spec.done
shot mse-spec
js JSON.stringify(window.spec.results)
assert window.spec.results.attach === true
assert window.spec.results.duration === true
assert window.spec.results.ranges === true
assert window.spec.results.remove === true
assert window.spec.results.removeSourceBuffer === true
assert window.spec.results.changeType === true
assert window.spec.results.abort === true
assert window.spec.results.reopen === true
assert window.spec.results.sequence === true
assert window.spec.results.detach === true
status done
quit
