【发布时间】:2016-09-27 11:45:30
【问题描述】:
我正在尝试为我的 react 应用程序实现一个“弹出”功能,该应用程序使用 video.js 提供流媒体服务。
本质上,下面的组件会在网站上呈现视频流。
<Player
ready={this.props.ready}
stream={stream}
streamName={ streamName }
ownStream={this.props.ownStream}
ref={`player-${stream.id}`}
unmount={this.props.unmount}
isSignedIn={this.props.isSignedIn}
dispatch={this.props.dispatch}
/>
点击弹出图标后,我希望在新窗口中只打开视频(而不是页面上的任何其他组件)。
所以我在我的路由文件中实现了以下内容
<Route path="/watch/popout_stream/:streamId" component={StreamPopout} />
所以现在我有一个单独的页面,仅用于渲染播放器。
但是我似乎没有办法将我所有的道具从现有窗口传递到新组件(因为它在不同的窗口上 - 我的 redux 状态也被刷新了)。
有什么方法可以在一个全新的窗口中将道具传递给新组件?
谢谢
【问题讨论】:
-
我认为这是在讨论here。该解决方案似乎与使用
window.open并将带有postMessage的状态发送到新窗口有关。 -
@CésarLandesa - 谢谢 :) 我会看看
标签: javascript reactjs react-router