wangzuo / react-videojs

react videojs wrapper
http://wangzuo.github.io/react-videojs/
ISC License
44 stars 19 forks source link

When render new src not update? #10

Open ghost opened 8 years ago

ghost commented 8 years ago

When component receive the new link it can't update link.

componentWillReceiveProps(next) {
        let that = this
        this.setState({
            link: next.data.link,
        })
}
render() {
        let atrVideo = {
            "id": "video",
            "type": "application/x-mpegURL",
            "className": "video-js vjs-default-skin",
            "data-setup": '{"preload" : "auto","autoplay" : false,"controls" : true}',
            "src" : {this.state.link}
        }
        return (
            <div className="htmlplayer col-md-12 col-xs-12">
                <div className="player">
                    <Video {...atrVideo}>
                    </Video>
                </div>
            </div>
        )
    }
}

Thx