import React, { View, WebView } from 'react-native';
export const YoutubeScreen = React.createClass({
render: function() {
return (
<View style={{flex: 1}}>
<WebView
style={{flex:1}}
javaScriptEnabled={true}
source={{uri: 'https://www.youtube.com/embed/ZZ5LpwO-An4?rel=0&autoplay=0&showinfo=0&controls=0'}}
/>
</View>
);
}
});
If instead of using source={{uri: youtubeUrl}} use source={{html: iframeHtml}} it works.
But i don't want to use an iframe since I can't have access to the html inside of the iframe.
On iOS works fine. Is that a bug or a normal behaviour for android?
edit: Might be related to this:
check out http://developer.android.com/reference/android/webkit/WebView.html and read HTML5 Video support part.
source: http://stackoverflow.com/questions/8122298/youtube-embed-videos-not-working-in-webview-whats-wrong-with-this-code
If instead of using
source={{uri: youtubeUrl}}usesource={{html: iframeHtml}}it works.But i don't want to use an iframe since I can't have access to the html inside of the iframe.
On iOS works fine. Is that a bug or a normal behaviour for android?
edit: Might be related to this:
set a WebChromeClient to your WebView
and turn on hardwareAccelerated value
check out http://developer.android.com/reference/android/webkit/WebView.html and read HTML5 Video support part.
source: http://stackoverflow.com/questions/8122298/youtube-embed-videos-not-working-in-webview-whats-wrong-with-this-code