Commit 5d0936d3 authored by Dorian Goepp's avatar Dorian Goepp

handle case when the topic is not published

parent 6c4352ff
......@@ -6,9 +6,19 @@ class VideoStream extends Component {
super(props)
const hasUrl = ('url' in this.props && this.props.url);
this.topic = '/pepper/image_raw';
this.defaultImage = '';
this.state = {
url: hasUrl ? this.props.url : 'http://localhost:8081/stream?topic=/pepper/image_raw'
}
url: hasUrl ? this.props.url : this.defaultImage
};
this.props.ros.getTopics(function(infos){
console.debug(infos.topics)
if (undefined !== infos.topics.find(elem => elem === this.topic)) {
this.setState({url: 'http://localhost:8081/stream?topic=' + this.topic});
}
}.bind(this))
}
handleSettingsChange(event) {
......
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