constructor(props) { super(props); this.state = { videos: [], selectedVideo: null }; // default term this.searchVideo('surfboards'); }
render() { const searchVideo = debounce((term) => this.searchVideo(term), 300); return ( <div> <SearchBar onSearch={ (term) => searchVideo(term) }/> <VideoDetails video={ this.state.selectedVideo } /> <VideoList onVideoSelect={ (selectedVideo) => this.setState({ selectedVideo })} videos={ this.state.videos } /> </div> ); }
render() { const { searchVideo } = this.props.actions; return ( <header> <div className={style.header}> <div className={style.link}> <Link to="/" > Main section </Link> <Link to="video"> Add video </Link> </div> <img src="http://htmlcoder.me/preview/the_project/v.1.2/template/images/logo_light_blue.png" /> <h1>Some weird video list</h1> <div className="form-group has-feedback"> <button type="button" onClick={() => searchVideo(this.state.text)} className={style.submitButton}> Search </button> <input type="text" className={style.formControl} onChange={::this.handleChange} placeholder="Search" /> </div> </div> </header> ); }
render () { const videoSearch = _.debounce(term => {this.searchVideo(term)}, 300); return ( <div className="main-container"> <Grid container justify="center" spacing={8}> <Grid item xs={12}> <Paper elevation={4} className="paper"> <SearchBar onSearchTermChange={videoSearch}/> </Paper> </Grid> <Grid item xs={12} sm={8}> <Paper elevation={4} className="paper"> <VideoDetail video={this.state.selectedVideo} /> </Paper> </Grid> <Grid item xs={12} sm={4}> <Paper elevation={4} className="paper"> <VideoList videos={this.state.videos} onVideoSelect={selectedVideo => this.setState({selectedVideo})} /> </Paper> </Grid> </Grid> </div> ); }
var results, timesSearched = 0; do { results = await searchVideo('v=' + randomid() + ' -nightcore', 50); // find a random video id and no nightcore timesSearched++; } while (results.length === 0 && timesSearched <= 4); findUniqueId(); async function findUniqueId() { // See if we've uploaded a video with this id in the desc let r = await searchVideo(video, 1, true); if (r.length == 0) { console.log(video + ' is a unique video');
render() { const searchVideo = _.debounce((term) => {this.searchVideo(term)}, 300); return ( <div> <SearchBar onSearchVideo={(term) => searchVideo(term)}/> <VideoDetail video={this.state.selectedVideo} /> <VideoList onSelectVideo={selectedVideo => this.setState({selectedVideo})} videos={this.state.videos} /> </div> ); }
constructor(props) { super(props); this.state = { videos: [], selectedVideo: null }; this.searchVideo('surfboards'); }
constructor(props) { super(props); this.state = { videos: [], selectedVideo: null }; this.searchVideo("volvo"); }