gpt4 book ai didi

google-chrome - hls.js 从 ANDROID mobile(chrome,webview 也)开始,而不是 live ***,但在桌面、ios 中工作得很好 .. hls.js 1.0.0 2021-04-01

转载 作者:行者123 更新时间:2023-12-04 23:20:41 26 4
gpt4 key购买 nike

我正在使用最新的 hls.js 1.0.0(不是 rc)流式传输 .m3u8,但版本为 2021-04-01...
例如:直播从下午 5 点开始,现在是下午 5 点 15 分...
几乎所有浏览器中的流都从实时点开始
我在这里看到的模式: android 中的所有浏览器(在 Android 10 中测试)不会在实时点开始,只有在 0...
我做了所有的测试
• Safari 桌面 => 5:15 直播
• Safari 手机 => 5:15 直播
• WebView (Android) => ••• ISSUE : 播放器在 0(下午 5 点) 开始播放流
• WKWebView (apple IOS iphone,ipad) => 5:15 直播
• Chrome 桌面 (mac/win) => 5:15 直播
• Chrome MOBILE (Android) => ••• 问题:播放器在 0(下午 5 点) 开始播放
• Chrome MOBILE (iPhone) => 5:15 直播
• Microsoft EDGE Desktop => 5:15 直播
• Microsoft EDGE mobile (android) => ••• ISSUE:播放器在 0(下午 5 点) 开始流式传输
• Firefox 桌面版 (mac/win) => 5:15 直播
• Opera Desktop (mac/win) => 5:15 直播
• Opera Mini (iPhone) => 5:15 直播
• Opera Mini (android) => ••• ISSUE : 播放器在 0(下午 5 点) 开始播放流
• Brave Desktop (mac/win) => 5:15 直播
• Brave Mobile (iPhone) => 5:15 直播
• Brave Mobile (android) => ••• ISSUE : 播放器在 0(下午 5 点)开始直播
这段代码

<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<center><video width="90%" height="600" id="video" controls="" src="" playsinline="true" preload="metadata" ></video></center>
<script>
var video = document.getElementById("video");
var videoSrc = "https://www.example1.com/streaming/index.m3u8";
if (video.canPlayType("application/vnd.apple.mpegurl")) {
video.src = videoSrc;
} else if (Hls.isSupported()) {
var config = {
autoStartLoad: true,
startPosition: -1,
debug: false,
capLevelOnFPSDrop: false,
capLevelToPlayerSize: false,
defaultAudioCodec: undefined,
initialLiveManifestSize: 1,
maxBufferLength: 30,
maxMaxBufferLength: 500,
backBufferLength: Infinity,
maxBufferSize: 60 * 1000 * 1000,
maxBufferHole: 0.5,
highBufferWatchdogPeriod: 2,
nudgeOffset: 0.1,
nudgeMaxRetry: 3,
maxFragLookUpTolerance: 0.25,
liveSyncDurationCount: 3,
liveMaxLatencyDurationCount: Infinity,
liveDurationInfinity: false,
enableWorker: true,
enableSoftwareAES: true,
manifestLoadingTimeOut: 10000,
manifestLoadingMaxRetry: 1,
manifestLoadingRetryDelay: 1000,
manifestLoadingMaxRetryTimeout: 64000,
startLevel: undefined,
levelLoadingTimeOut: 10000,
levelLoadingMaxRetry: 4,
levelLoadingRetryDelay: 1000,
levelLoadingMaxRetryTimeout: 64000,
fragLoadingTimeOut: 20000,
fragLoadingMaxRetry: 6,
fragLoadingRetryDelay: 1000,
fragLoadingMaxRetryTimeout: 64000,
startFragPrefetch: false,
testBandwidth: true,
progressive: false,
lowLatencyMode: true,
fpsDroppedMonitoringPeriod: 5000,
fpsDroppedMonitoringThreshold: 0.2,
appendErrorMaxRetry: 3,
enableWebVTT: true,
enableIMSC1: true,
enableCEA708Captions: true,
stretchShortVideoTrack: false,
maxAudioFramesDrift: 1,
forceKeyFrameOnDiscontinuity: true,
abrEwmaFastLive: 3.0,
abrEwmaSlowLive: 9.0,
abrEwmaFastVoD: 3.0,
abrEwmaSlowVoD: 9.0,
abrEwmaDefaultEstimate: 500000,
abrBandWidthFactor: 0.95,
abrBandWidthUpFactor: 0.7,
abrMaxWithRealBitrate: false,
maxStarvationDelay: 4,
maxLoadingDelay: 4,
minAutoBitrate: 0,
emeEnabled: false
};
var hls = new Hls(config);
hls.loadSource(videoSrc);
hls.attachMedia(video);
}
video.addEventListener("loadedmetadata", function(){ video.muted = true; video.play(); }, false);
</script>
//这里我添加了 video.muted = true;视频.play();要自动启动,如果我尝试取消静音自动播放,许多浏览器会拒绝此命令...
//safari 需要 playinline="true"
••••••• FFMPEG 命令(工作:它允许我延迟 3 到 4 秒••••••
ffmpeg -re -i input.x -c:a aac -c:v libx264 
-movflags +dash -preset ultrafast
-crf 28 -refs 4 -qmin 4 -pix_fmt yuv420p
-tune zerolatency -c:a aac -ac 2 -profile:v main
-flags -global_header -bufsize 969k
-hls_time 1 -hls_list_size 0 -g 30
-start_number 0 -streaming 1 -hls_playlist 1
-lhls 1 -hls_playlist_type event -f hls path_to_index.m3u8
••••••••••••••••••••••••••••••••••••••••••••••••• •••••••••••••••••••••••••••••••••••
如何解决这个问题?
如何在 android MOBILE 中实时加载?

最佳答案

我试过video.currentTime = ( parseFloat(video.duration) - 1 );这和它的工作;)
视频标签

<video width="90%" height="600" id="video" 
controls="" src="" playsinline="true" preload="metadata" ></video>
和脚本
<script>
video = document.getElementById("video");

//the regular HLS portion loadSource attachMedia...

video.addEventListener("loadedmetadata", function({
video.muted = true;
setTimeout(function(){
video.currentTime = ( parseFloat(video.duration) - 1 );video.play();
}, 1169);
}, false);

<script>
视频标签中的 preload="metadata"很重要,因为 video.addEventListener("loadedmetadata"有魔法吗……

关于google-chrome - hls.js 从 ANDROID mobile(chrome,webview 也)开始,而不是 live ***,但在桌面、ios 中工作得很好 .. hls.js 1.0.0 2021-04-01,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66926044/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com