Commit fa130622 authored by 李纪文's avatar 李纪文

feat: 视频vms增加自定义参数

parent ca0d1964
...@@ -23,12 +23,14 @@ class App extends React.Component { ...@@ -23,12 +23,14 @@ class App extends React.Component {
} }
createAll() { createAll() {
let { VideoInfo, JessibucaObj } = this.props; let { VideoInfo, JessibucaObj } = this.props;
const { params = {} } = VideoInfo;
const queryStr = this.toQueryString(params);
this.destroy(); this.destroy();
if (VideoInfo.url) { if (VideoInfo.url) {
this.create(this.refs[`myVideo` + VideoInfo.id], `key`, JessibucaObj); this.create(this.refs[`myVideo` + VideoInfo.id], `key`, JessibucaObj);
setTimeout(() => { setTimeout(() => {
let code = window.independence ? window.siteCode : window.globalConfig?.userInfo?.site; let code = window.independence ? window.siteCode || '' : window.globalConfig?.userInfo?.site || '';
let siteInfo = !code ? '' : `?_site=${code}`; let siteInfo = !code ? `?${queryStr}` : `?_site=${code}&${queryStr}`;
this.play(VideoInfo.url + `/${VideoInfo.dataRate == 'Sub' ? 2 : 1}${siteInfo}`, `key`); this.play(VideoInfo.url + `/${VideoInfo.dataRate == 'Sub' ? 2 : 1}${siteInfo}`, `key`);
}, 10); }, 10);
} }
...@@ -189,9 +191,11 @@ class App extends React.Component { ...@@ -189,9 +191,11 @@ class App extends React.Component {
changeRate(text) { changeRate(text) {
const { VideoInfo } = this.props; const { VideoInfo } = this.props;
const { params = {} } = VideoInfo;
const queryStr = this.toQueryString(params);
if (VideoInfo.url && this.jessibuca) { if (VideoInfo.url && this.jessibuca) {
let code = window.independence ? window.siteCode : window.globalConfig?.userInfo?.site; let code = window.independence ? window.siteCode || '' : window.globalConfig?.userInfo?.site || '';
let siteInfo = !code ? '' : `?_site=${code}`; let siteInfo = !code ? `?${queryStr}` : `?_site=${code}&${queryStr}`;
this.jessibuca.play(VideoInfo.url + `/${text == '标清' ? 2 : 1}${siteInfo}`); this.jessibuca.play(VideoInfo.url + `/${text == '标清' ? 2 : 1}${siteInfo}`);
this.setState({ this.setState({
isPlaying: true, isPlaying: true,
...@@ -217,6 +221,14 @@ class App extends React.Component { ...@@ -217,6 +221,14 @@ class App extends React.Component {
</div> </div>
); );
} }
toQueryString(obj) {
return Object.keys(obj)
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]))
.join('&');
}
render() { render() {
return <div className={style.root} ref={this.domRef}>{this.renderCheckedArr()}</div>; return <div className={style.root} ref={this.domRef}>{this.renderCheckedArr()}</div>;
} }
......
...@@ -45,6 +45,10 @@ const Demo1 = (props) => { ...@@ -45,6 +45,10 @@ const Demo1 = (props) => {
password: '78b7dc88f9f4bf19c2b1aabfdd995244', password: '78b7dc88f9f4bf19c2b1aabfdd995244',
pandavmsHost: 'ws://192.168.8.30:7000/', pandavmsHost: 'ws://192.168.8.30:7000/',
address: 'C83178215', address: 'C83178215',
params: {
name: 1,
title: 2,
}
}; };
let VideoParam1 = { let VideoParam1 = {
id: '38FB4BA7-C61F-466C-9B57-5B401441DABC', id: '38FB4BA7-C61F-466C-9B57-5B401441DABC',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment