android - Youtube video in Webview and listview using React Native -


i new in react native. facing problem of youtube videos playing audio only. below code using now:

import react, { component } 'react'  import {    view,    listview,    webview,    stylesheet,    scrollview } 'react-native'   url=[     {     "videourl":"https://www.youtube.com/embed/znvjvzajzpk",     },     {     "videourl":"https://www.youtube.com/embed/hoi8nlfa86u",     },     {     "videourl":"https://www.youtube.com/embed/0bdi_ramv68",     },     ]  class webviewexample extends component{    constructor (props) {     super (props);      const ds = new listview.datasource({       rowhaschanged: (r1, r2) => r1 !== r2     });      this.state = {       datasource: ds.clonewithrows(url),     };   }    render(){     return (       <listview         datasource={ this.state.datasource }         renderrow={this.renderrows.bind(this)}       />     );   }   renderrows(rowdata){     console.log("url: "+rowdata.videourl);     return(       <view style={styles.container}>         <view style={{borderwidth:3, bordercolor : '#ff0000', flex:1}}>           <webview source={{uri: rowdata.videourl}} style={{}} />         </view>       </view>     );   } } export default webviewexample;  const styles = stylesheet.create({    container: {       height: 350,    } }) 

react native version:0.47

though code correct, throw error have mention url const

const url=[     {     "videourl":"https://www.youtube.com/embed/znvjvzajzpk",     },     {     "videourl":"https://www.youtube.com/embed/hoi8nlfa86u",     },     {     "videourl":"https://www.youtube.com/embed/0bdi_ramv68",     },     ]; 

check expo

note: video won't display in expo web version, able see in mobile version.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -