加载视频失败对HTML5的PhoneGap加载、视频、PhoneGap

由网友(大可当众抱住我)分享简介:我要显示本地视频HTML5视频标签上的PhoneGap的Andr​​oid有什么不对这个网站code:?I want to show local videos by HTML5 video tag on phonegap androidWhat is wrong with this html code?:我要显示本地视频HTML5视频标签上的PhoneGap的Andr​​oid 有什么不对这个网站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.

注:生,是里面的资源文件夹中的文件夹名称,我以前把视频文件中的Andr​​oid

Note: "raw" is the folder name inside "res" folder, I used to keep the video file in Android.

阅读全文

相关推荐

最新文章