<video> tag not working android emulator
I am new android development. I am using the video tag. But while running it on the emulator the video does not play. Although the video works fine on browser. Can some one help me out in what I am missing.
<video id="video" autoplay width="500" height="400" controls="controls">
<source src="http://ec2-50-16开发者_开发技巧-201-31.compute-1.amazonaws.com/p/100/sp/10000/flvclipper/entry_id/0_hu1hm4qg" />
not working
<script type="text/javascript">
var video = document.getElementById('video');
video.addEventListener('click',function(){
video.play();
},false);
I am using phonegap as well. Java Code : App.java
public class App extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
appView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimeType, long size) {
Intent viewIntent = new Intent(Intent.ACTION_VIEW);
viewIntent.setDataAndType(Uri.parse(url), mimeType);
try {
startActivity(viewIntent);
} catch (ActivityNotFoundException ex) {
Log.w("YourLogTag",
"Couldn't find activity to view mimetype: "
+ mimeType);
}
}
});
}
}
I am not familiar with phoneGap but you need to call it on your WebView. loadUrl(String url) is a method of the WebView class so assuming the DroidGap class extends WebView then you'd call super.setJavascriptEnabled(true);
If DroidGap isn't actually extending WebView and is instead just passing along what you give it in loadUrl to a private WebView object contained inside it, then using super is not going to work. You'll have to find a way to get a reference to the WebView that is actually being used to display your page. Maybe droidGap has something like .getWebView() or something?
精彩评论