play video and download using webview - javascript

I need javascript code to detect play button of video on web-page in web-view and start downloading on click of button in android web-view
I have used javascipt code to solve this issue it download video but didn't play in web-page stuck video play button in website
page.loadUrl("javascript:(function prepareVideo() { "
+ "var el = document.querySelectorAll('div[data-sigil]');"
+ "for(var i=0;i<el.length; i++)"
+ "{"
+ "var sigil = el[i].dataset.sigil;"
+ "if(sigil.indexOf('inlineVideo') > -1){"
+ "delete el[i].dataset.sigil;"
+ "console.log(i);"
+ "var jsonData = JSON.parse(el[i].dataset.store);"
+ "el[i].setAttribute('onclick', 'FBDownloader.processVideo(\"'+jsonData['src']+'\",\"'+jsonData['videoID']+'\");');"
+ "}" + "}" + "})()");
page.loadUrl("javascript:( window.onload=prepareVideo;"
+ ")()");
I need javascript code that when I click on video default button to play so video starts playing and by clicking on other button defined by me to start download file

Related

Why won't my google web app won't load on my google site in Safari?

I made a simple Google Site that runs a Google Web App that I wrote and published. The Web App pulls data from a Google Sheet. The Web App runs perfectly if you view my site in Chrome, but doesn't load at all if you view the site in Safari (the rest of the Site content loads fine though). Why would this be? Are Google Web Apps supported in Safari?
In case it matters, below is what my Web App's doGet() outputs. It's not pretty, I know. I'm planning to learn how to use templated HTML outputs. Figuring out how to output HTML code as a string is a stepping stone, so to speak.
var HTMLString = "<font face=arial><table align=center><tr><td>" +
"<h3 align = center>Album no. " +
"<font color=#1abc9c>" + albumrand + "</font> picked by <font color=#1abc9c>" + pick + "</font>:" +
"</h3>" +
"<h2 align = center><font color=#1abc9c>" + title + "</font>" +
"</br>by</br>" +
"<font color=#1abc9c>" + artist + "</font>" +
"</h2>" +
"<h4 align=center> Refresh page for another pick</br>| Pull down (mobile) | F5 (desktop) |</h4>" +
"</td></tr></table></font>";
return HtmlService.createHtmlOutput(HTMLString);
The issue was that when deploying the Web App, I had the 'access' set to "anyone". I redeployed, changing the access to "anyone, even anonymous", and now it works in both Chrome-Inognito and Safari.

HTML/PHP Block news tabs on Android and iOS browsers

I use this code for codebar scan with cellphone, on Google Chrome works but on Firefox and Samsung Browser after scan barcode an another tab are created, and +1 tab per scan.
My code:
window.top.location.href = "zxing://scan/?ret=" + href + "profile_sps.php?barid={CODE}";
I tried several ways:
window.open("zxing://scan/?ret=http://rodrigovrodrigues.tk/sjb/profile_sps.php?barid={CODE}", "_top");
window.self.location.href = "zxing://scan/?ret=" + href + "profile_sps.php?barid={CODE}";
window.parent.location.href = "zxing://scan/?ret=" + href + "profile_sps.php?barid={CODE}";
And some others...
Any friend can help me with this?
Thanks for all help.

Can audio be triggered to play during phone lock

I am making a web chat app and now I am in need of playing notification sounds as a new message arrives.
To begin with I am using howler.js to play the sounds. In howler we can start playing a sound and then if we lock the screen or change browser tab focus it keeps playing. But it doesn't start playing the sound if the tab is opened and mobile screen is locked nor does it play if the user is on another tab with the app on another tab opened.
So basically my question is, is it possible to start playing sound even when screen is locked or start playing the sound when user is on another tab?
app.js
var notify_sound = new Howl({
src: ['./assets/sounds/notify2.mp3'],
volume: 1.0
});
.
.
.
.
.
.
.
.
if(type == "user"){
if(userAddress == remoteAddress) {
typing.html('').fadeOut('fast');
messages.append('<li class="self"><p class="message">'+ obj.message + '</p><p class="time">' + time +'</p></li><p class="username_self">' + userAddress + '</p>');
}
else {
typing.html('').fadeOut('fast');
messages.append('<li class="other"><p class="message">'+ obj.message + '</p><p class="time">' + time +'</p></li><p class="username_other">' + userAddress + '</p>');
notify_sound.play();
}
}
HTML5 audio and mobile don't really get along. Howler.js (If you're using 2.0) uses a workaround to get audio to 'autoplay' at all by attaching an event handler to the first touch event that'll trigger playback. If the view isn't active, there won't be a touch event (even a simulated one) to trigger playback.
From the docs:
Mobile Playback
By default, audio on iOS, Android, etc is locked until a sound is
played within a user interaction, and then it plays normally the rest
of the page session (Apple documentation). The default behavior of
howler.js is to attempt to silently unlock audio playback by playing
an empty buffer on the first touchend event. This behavior can be
disabled by calling:
Howler.mobileAutoEnable = false;
If there's no initial interaction, there's not much you can do.

Pinterest share without pin it button

Can I create pinterest share without pin it button? I had try using these but it seem fail.
Pin it
Pin it
Is there any way I can create a pinterest share link without pin it button?
Try making your hyperlink url like this, this worked for me
string url = "http://pinterest.com/pin/create/button/" +
"?url=" + "your link" +
"&media=" + "link to youre image" +
"&description=" + "your description";
both media and description can be blank so you could do
string url = "http://pinterest.com/pin/create/button/" +
"?url=" + "" +
"&media=" + "" +
"&description=" + "";
to test it out
in my code im calling a redirect after a button press but i think this should work for you.

htaccess file nomenclature creating problem in opening a popup window in IE

My htaccess file nomenclature creating problem in opening a window in IE
EDITED
I have to open a colour picker which needs t be opened in popup, and I have
window.open('picker.html', null, "help=no,status=no,
scrollbars=no,resizable=no,toolbar=
no" + move + ",width=" + w + ",height=" + h + ",dependent=yes", true);
my base url goes like this:
http://www.mydoamin.com/
and the htaccess file has rewritten the above url from http://www.mydomain.com/30/
but when i wish to open the popup in IE the htaccess doesnt work for it and gives me url as http://www.mydomain.com/30/picker.html
and hence i get msg as broken link or NOT FOUND
there is no such folder called "30" the path has to be like http://www.mydomain.com/picker.html
The rewrite rule of the particular page goes like this:
RewriteRule
^30/order-vinyl-banners.html
order_form.php?id=30 [NC]
why is it happening..
please help me to track it..
If you want to show http://www.example.com/picker.html, you need to tell the open() function so. Right now you're telling it "Open the URL picker.html relative to where I'm currently at", but you want "Open picker.html relative to the root". Try this instead:
window.open('/picker.html', null,
"help=no,status=no,scrollbars=no,resizable=no,toolbar=no"
+ move + ",width=" + w + ",height=" + h + ",dependent=yes", true);

Categories