Skip to content
Snippets Groups Projects
Commit 5d0936d3 authored by Dorian Goepp's avatar Dorian Goepp
Browse files

handle case when the topic is not published

parent 6c4352ff
Branches
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment