Loading an mp4 video from an html link on Android - android

I have a html file on my Samsung android tablet that has a link like this:
Click to play local 0001_a1.mp4
When I click it I wanted it to open the video file that is in the sub directory /video beneath but only the link background changes like the link is being pressed but no video plays. If I remove the video file and press the link I get an error that it can't find the file. So I know that something is trying to happen. I have also tried
Click to play local 0001_a1.mp4
With the same results. Both work fine when on a Windows PC.
How can I load local videos using an html link on Android?

In mobile browsers you must call window.open inside onClick instead of set href attribute:
<a href="#" onclick="window.open('./video/0001_a1.mp4','_blank')">
Click to play local 0001_a1.mp4
</a>

Related

Make an simple Android App / Webview & local pages

I am trying to build a simple app, using Webview.
I just want to create an app that contains 2 html files (stored in assets folder). At loading, app display page1.html in webview.
On this page, there is a link to page2.html (in html format : href=""). I need this page opens also in webview.
I tried, but when I click on the link, the app closes... I tried href="page2.html", href="file:///android_asset/page2.html"... Nothing works.
Do you have any example of a simple app like this ?
Thanks.

How to handle input type=file event from ios?

Currently I'm developing a website (that mainly runs in iOS WKWebView) and a native iOS app.
Normally, if I want to select some image or video to upload in webpage inside webview, this is what happens:
Click html input tag (ex. <input type="file" ... /> )
Choose 'Photo Library' option
Choose images or videos and click add
Files are loaded in webview
Question:
Is there any way to do some stuff in between 3 and 4?
For example, can I select a video file, modify it, and then pass the modified file to browser?
In Android WebChromeClient, it handles html input tag with onShowFileChooser which has callback to return the list of selected files to the browser. In this scenario, the app can do whatever stuff before passing the result to the callback.
Does iOS webkit have some equivalent method like this?
Or, is there a way to manually select files from native app and pass it to the html input tag inside webview?

Iframe embedded youtube video not working on android?

I have the following piece of code :
<iframe width="420" height="345" src="http://www.youtube.com/embed/OZOX5sad2FE" frameborder="0" allowfullscreen></iframe>
It works good on desktop, but when opened on a android device, the following message appears:
Do you want to download the following file OZOX5sad2FE ?
YES/BLOCK
Clicking YES or BLOCK and the iframe is empty, there`s nothing there ..
What is going on ?
Desktop gonna work always (if its update).. But maybe your device is not compatible on browser with YTB.. Did u try to load youtube video on another website where is embedd code (iframe) from YTB ? ..

Android: playing video in Webview using HTML 5

I wanted to play video in webview using html page. i created html page and kept in asset folder and video are stored in sdcard.
Thanks in advance.
see https://gist.github.com/3718414 for a sample which plays video in a webview. It shows how to either reference the HTML as a URL or assemble it inline.
you will need to make sure that you also take note of the permissions mentioned in the comments

Android 3.2 videos on webapp with phonegap

I already know the issue about videos not playing on webview. I found the video.js plugin from Simon Mac Donald.
I did all the process of installation, but now i don´t know where tu put the code.
window.plugins.videoPlayer.play("http://path.to.my/file.mp4");
In my page there is a button linked to a video.html where the video will be launched on full screen, play, stop and give a option to replay or to come back to the button´s page. For instance:
<li id="XY"><span>goods</span></li>
Thank you.
This code is written in javascript inside the script tag like below:
$("#video").live('click', function(){
alert('video sample');
window.plugins.videoPlayer.play("file:///sdcard/famous.3gp");
});
where #video is the id of the html element.
But in this also i am facing error alert which says "sorry, this video can not be played"
Not sure why.

Categories

Resources