H5 will not be playable on Android. M3U8 will be streamed live, the console will report an error

Uncaught (in promise) DOMException: The element has no supported sources.

Add the following code to app.vue’s onLaunch method:

// #ifdef H5 if (uni.getSystemInSync (). Platform! = 'ios') { var script = document.createElement("script"); script.src = "https://cdn.jsdelivr.net/npm/hls.js@latest"; script.onload = function() { let init = function(video) { if (! video.getAttribute('hls-inited')) { let hls = null; let load = function() { let src = video.src; if (! src || src.indexOf('.m3u8') < 0) return if (! hls) { hls = new Hls(); hls.attachMedia(video); } hls.loadSource(src); } video.addEventListener("error", function() { load(); }, false); video.addEventListener("DOMNodeRemovedFromDocument",function(){ if(hls){ hls.destroy() } }, false); video.setAttribute('hls-inited', 'ok'); } } document.getElementsByTagName("video").forEach(init) document.body.addEventListener("DOMNodeInserted", function(e) { let ele = e.relatedNode; if (ele.tagName === 'VIDEO') { init(ele); } ele.getElementsByTagName("video").forEach(init) }) } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(script, s); } // #endif