在下面的示例中,我尝试捕获此脚本中的所有视频。但是,我只能捕捉第一个视频。getElementById
我知道这与and not有关querySelectorAll
,但我不确定如何在这个脚本中实现它。
var videoId = document.getElementById("wistia_video");
var uniqueVideoId = Array.from(videoId.classList)
.find((c) => c.startsWith("wistia_async_"))
.substring(13);
// console.log(uniqueVideoId);
const clickToPlay = document.querySelectorAll('.wistia')[0];
clickToPlay.addEventListener('click', function() {
const playVideo = clickToPlay.querySelectorAll('.wistia__overlay, .embed-youtube__play');
Array.from(playVideo).forEach((elem) => elem.remove());
//supporting scripts
let wistiaSupportScripts = [
`https://fast.wistia.com/assets/external/E-v1.js`,
//adds jsonp file to provide security over requests
`https://fast.wistia.com/embed/medias/${uniqueVideoId}.jsonp`
];
//loads supporting scripts into head
for (var i = 0; i < wistiaSupportScripts.length; i++) {
let wistiaSupportScript = document.createElement("script");
wistiaSupportScript.src = wistiaSupportScripts[i];
let complete = false;
if (!complete …
Run Code Online (Sandbox Code Playgroud)我们有视频CMS门户网站,可为React Native移动应用程序提供支持。
方法1: 使用效果很好的react-native-video,但是我意识到要播放直接视频文件URL。使用Wistia API提取视频网址很容易,但是由于它以不同格式存储视频,因此我们需要知道哪种分辨率,或者一些如何使用“自动”设置进行视频分辨率,从而根据屏幕大小和互联网连接确定正确的视频。API无法使用此设置。一种解决方案可能是实际检测到该错误并将其传递给后端,做出决定并传递回正确的资产网址。这有点不对劲,因为要使视频正常工作涉及太多的间接工作。所以我看了其他选择
方法2
使用IFrame的源属性并包括IFrame。这适用于Youtube视频,但由于某种原因无法与Wistia一起使用。找不到任何实际上能使它正常工作的要点/摘要。
方法3 使用平台特定的组件,例如react-native-wistia。我已请求作者的帮助(在github上引发问题),因为无法从npm注册表中安装它。
方法2似乎是最通用且最适合要求的方法(除非我完全缺少其他方法)。
我的问题是:
我有一个像这样嵌入的 ReactPlayer:
<ReactPlayer
ref={this.ref}
className="storyPlayer__reactPlayer"
width="100%"
height="100%"
url="https://getleda.wistia.com/medias/bjz07hdxqx"
playing
onReady={() => {
this.setState({ ready: true });
}}
onProgress={this.onProgress}
/>
Run Code Online (Sandbox Code Playgroud)
当 url 明显指向 wistia 时,我在控制台中收到以下错误,并且播放器无法工作:
judy XMLHttpRequest 构造函数已被篡改。由于这会影响 CORS/Range XHR 请求,因此已禁用 HLS 播放。要启用 HLS 播放和其他重要功能,请删除更改 window.XMLHttpRequest 定义的代码。
有什么想法导致此问题以及如何解决吗?
我的目标是接受上传的文件并使用Wistia Upload API将其流式传输到Wistia。我需要能够向 HTTP 请求添加字段,并且我不希望文件接触磁盘。我正在使用Node、Express、Request和Busboy。
下面的代码有两个console.log
语句。第一个返回[Error: not implemented]
,第二个返回[Error: form-data: not implemented]
。我是 Node 中的流媒体新手,所以我可能在做一些根本性的错误。任何帮助将非常感激。
app.use("/upload", function(req, res, next) {
var writeStream = new stream.Writable();
writeStream.on("error", function(error) {
console.log(error);
});
var busboy = new Busboy({headers: req.headers});
busboy.on("file", function(fieldname, file, filename, encoding, mimetype) {
file.on("data", function(data) {
writeStream.write(data);
});
file.on("end", function() {
request.post({
url: "https://upload.wistia.com",
formData: {
api_password: "abc123",
file: new stream.Readable(writeStream)
} …
Run Code Online (Sandbox Code Playgroud) 有人可以告诉我是否可以在本地iOS视频播放器中嵌入vistia吗?我们正在寻找在YouTube上托管视频的替代选项,并且已经听说过有关vistia的一些好处。目前,我们的应用直接在本地视频播放器中播放YouTube网址。提前致谢。
wistia ×5
javascript ×2
video ×2
busboy ×1
express ×1
ios ×1
node-request ×1
node.js ×1
react-native ×1
reactjs ×1
youtube ×1