加载视频失败对HTML5的PhoneGap [英] Loading video failed on html5 phonegap
问题描述
我要显示本地视频HTML5视频标签上的PhoneGap的Android 有什么不对这个网站code:?
I want to show local videos by HTML5 video tag on phonegap android What is wrong with this html code?:
<video controls width="300" height="300">
<source src="file:///android_asset/www/data/video.m4v">
<source src="file:///android_asset/www/data/video.webm">
</video>
它不工作,不能播放视频。
It doesn't work, video doesn't play.
此外,它不工作:
<video controls width="300" height="300"><source src="data/video.m4v"><source src="data/video.webm"></video>
但是,当我打开从远程服务器它运作良好的视频(我加载从服务器相同的视频文件):
But when I load videos from remote server It works well(I load the same video file from server):
<video controls width="300" height="300">
<source src="http://192.168.1.140/video.m4v">
<source src="http://192.168.1.140/video.webm">
</video>
我建立并运行在Android上。
I build it and run on Android.
推荐答案
我发现了另一种方式来获得在android.Put路径的视频里面的资源文件夹,并设置视频播放器的src为android.resource://你的.package.name /生/ videofilename。不要把视频扩展。 在IOS你可以把它放在资产的文件夹,并访问其为文件夹名/ videoName.mp4。虽然是老文章中,我希望这会帮助别人。
I found another way to get the path in android.Put the video inside "res" folder and set video player src as "android.resource://your.package.name/raw/videofilename". Don't put the video extension . In IOS you can put it inside assets folder and access it as "foldername/videoName.mp4". Though it is and old post I hope it will help somebody.
注:生,是里面的资源文件夹中的文件夹名称,我以前把视频文件中的Android
Note: "raw" is the folder name inside "res" folder, I used to keep the video file in Android.
这篇关于加载视频失败对HTML5的PhoneGap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!