我正在显示来自源的实时视频。现在,单个i帧正在显示来自解密源的一页视频。我想从生成字符串的解密源中添加多个iframe。该字符串需要与数组分开并显示在数组中。通过数组源链接,我的iframe将加载视频。
import React, { Component } from 'react';
class IframeComp extends Component {
render() {
return (
<div >
<iframe ref={component => this.iframe = component} title="frame" src={this.getIframeUrl()} ></iframe>
</div>
);
}
}
export default IframeComp;
如何从网址数组中加载多个iframe?
import React from 'react';
import IframeComp from "../commonComponents/IframeComp";
import {decrypt} from "../utils/encryptDecrypt";
class LiveViewComponent extends IframeComp {
componentDidMount(){
let cameraStreamUrlDecoded = decrypt(this.props.match.params.cameraStreamUrl);
this.iframe.onload = () => {
this.iframe.contentWindow.postMessage(cameraStreamUrlDecoded, window.location.href);
}
}
rs
getIframeUrl(){
return "/liveView";
}
}
export default LiveViewComp;