ios - 在 iphone 中管理 hls native 行为?

标签 ios iphone xmlhttprequest http-live-streaming

我创建了一个视频服务服务,在我的应用程序中使用 hls 格式的视频和播放视频我使用 flowplayer。

我面临的问题是,在我的 m3u8 文件中,我有 ts 文件第一部分的这个 url。

http://****/videos/2017/9/39594b34-e06e-415b-a176-c6971fe28190/b7f1d54e-4543-4852-9fbe-75693c2bfe58-3600.ts

这是我对 flowplayer 的 html 配置
<div id="hlsjsvod">

这是我对 flowplayer 的 javascript 配置
flowplayer("#hlsjsvod", {
                    splash: true,
                    aspectRatio: "16:9",
                    clip: {
                        // enable hlsjs in desktop Safari for manual quality selection
                        // CAVEAT: may cause decoding problems with some streams!
                        hlsjs: {
                            safari: true,
                            xhrSetup: function (xhr, url) {
                                 url.replace("http","https")
                            }
                        },
                        sources: [
                            {
                                type: "application/x-mpegurl",
                                src: "http://****/videos/2017/8/a9b68f36-c229-47c9-850d-0af298692693/348b790b-0cc1-4817-b846-acef88f1067b-master.m3u8"
                            }
                        ]
                    }
                });

想要做的是将 ts 文件的 http 更改为 http;

正如您在上面的代码中看到的,我可以通过 xhrsetup 更改它。

在我想在 ios 和 iphone 中访问 xhrsetup 之前,一切都很好。因为 iphone 使用 native hls,它不会在 ios 中通过我的 xhrsetup 代码,我也希望能够在 ios 中执行此操作。

有没有人有任何解决方案?

最佳答案

这根本不可能。

macOS 上的 Safari 提供 MediaSource Extension (MSE)哪些玩家喜欢hls.jsBitmovin可以使用 Javascript 来播放 HLS,而不是 Safari 的原生 HLS 播放。

iOS 上的 Safari does not provide the MSE .因此,任何 HLS 播放器都必须使用 Safari 的 native HLS 播放,它根本不提供干扰请求的方法。

关于ios - 在 iphone 中管理 hls native 行为?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46014301/

相关文章:

javascript - XMLHttpRequest 和 setInterval 的内存泄漏

javascript - 如何使用 jQuery 异步上传文件?

ios - UIView transition With View 动画属性变化 : slide in from right?

ios - 设置 UIButton 大小以在 Storyboard 上显示

ios - 在SwiftUI中创建自定义alertSheet

ios - 在 UItableView Cell 中自动添加图像?

iphone - tableview 删除部分中的最后一行

ios - Apple Watch 无法将数据传递至 iPhone - Swift

jquery - 从另一个本地主机访问 markLogic

ios - MSAL库登录无响应