How can I play videos from a raw folder in an .htm file on android?
Neither of these code snippets work for me:
<video id="video" controls>
<source src="android.resource://tutorials.bodybuilding/raw/smit.mp4" type="video/mp4">
</video>
or
<video id="video" controls>
<source src="url('android.resource://tutorials.bodybuilding/raw/smit.mp4')" type="video/mp4">
</video>
According to reading file in assets or raw folder in Android I guess your addresses are wrong. You should consider what
Uri.parse("android.resource://tutorials.bodybuilding/" + R.raw.csgsmit);
returns for every of your videos and place it into html OR at runtime load html into a String and replace every address using such method and then load modified html using Webview.loadData() or Webview.loadDataWithBaseUrl() passing a modified html (a resluting String).
Related
<!DOCTYPE html>
<html>
<body>
<h3>Basic English Lesson Listen & Speak</h3>
<video width="320" height="240" controls>
<source src="BASIC ENGLISH LESSON 14.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
The video file is in the same directory folder as my html file.
I need guidance on why its not working on my android 11 OS tablet.
You have to call video.play() in order to play videos in android
Try this:
<!DOCTYPE html>
<html>
<body>
<h3>Basic English Lesson Listen & Speak</h3>
<video width="320" height="240" controls>
<source src="BASIC ENGLISH LESSON 14.mp4">
Your browser does not support the video tag.
</video>
</body>
<script>
var video = document.getElementById('video');
video.addEventListener('click',function(){
video.play();
},false);
</script>
</html>
It is about which browser you using ,
If your browser running on older version then you found this type of error.
I suggesting you for use google chrome I think it will work fine.
or else you have to give full path of video if in your android drive.
Hi I have developed an Android application which load Html5 file, that contains .mp3 files. The html files are stored inside the android asset folder. But when I try to load, the file is not playing. This is my path. webView.loadUrl("file:///android_asset/kids_sample/baba.mp3");
instead of loading audio files in WebView, load in MediaPlayer class.
and if you really want to load audio files in webView, then you have to code audio files in html file and load that html file in WebView.
example
<html>
<body>
<audio controls>
<source src="kids_sample/baba.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
</body>
</html>
I have the following video HTML:
<video id="player_a" class="video-js" controls preload="auto" title="Home video" width="640" poster="~/Assets/img/video_poster_full.jpg" data-setup="{}">
<source src="https://#####.blob.core.windows.net/video/homepage-video.mp4" type="video/mp4">
<source src="https://#####.blob.core.windows.net/video/homepage-video.webm" type="video/webm">
<source src="https://#####.blob.core.windows.net/video/homepage-video.ogv" type="video/ogg" />
<p class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
supports HTML5 video
</p>
</video>
On Android, this video does not play from the webpage. But as soon as I change my video host from the Azure Blob to my own private server (http://myserver.net/images/homepage-video.mp4), it streams fine.
I notice that if I just go directly to the URL of the .mp4, it does not load from Blob (but does from my private server). I also notice that the .webm does load okay from Blob but for some reason, my video is not falling back to that format.
Are there any settings I need to change in Azure Blob to allow .mp4 to be streamed differently? Or what am I doing wrong that is not causing the video to fall back to .webm?
The permissions on your blob will need to be public to make sure that you can access the content without a key. You can check this in the properties of the container.
In the documentation you can find an excellent post on how to set these permissions up.
I am new to cordova phonegap, i want to browse the video from sdcard and play the video in android. I have tried by hard coding the file uri,
<video id="1" width="100%" >
<source src="file:///storage/0/emulated/videos/video3.mp4" type="video/mp4" />
</video>
it is not working.
Please help me.
Did you try to call
var myVideo = document.getElementById("1");
myVideo.load();
in your script?
in video tag src we are trying to give src as a ftp resource its not picking it up. Can somebody give some direction on that.
<video src='ftp://server/pqr.mp4' />
I suspect that's because to allow efficient usage, the browser makes HTTP range requests, which are part of HTTP, not FTP. FTP is a pretty old protocol, and isn't really appropriate here for lots of reasons (no range requests, basic/no caching info, etc).
something like this
<video width="320" height="240" controls="controls">
<source src="http://movie.mp4" type="video/mp4" />
<source src="http://movie.ogg" type="video/ogg" />
Your browser does not support the video tag.
</video>
The issue here is :
Loading an FTP sub-resource through an HTTP / S page is not allowed
This is for security issues, see https://bugzilla.mozilla.org/show_bug.cgi?id=1361848
Use this code:
<video width="320" height="240" controls="controls">
<source src="http://movie.mp4" type="video/mp4" />