The redirect at the end of the snippet works on Desktop machine but not on Mobile Phone (Android device)
var ajax1 = XMLHttpRequest();
var sigData = encodeURIComponent(canvas.toDataURL("image/png"));
ajax1.open("POST", './post.php');
ajax1.send(sigText.innerHTML);
$('#debug').html(canvas);
document.location.href='step2.php?xidx="+xidx+"';
Related
I made an app that is just a webview showing a website, at a certain point in my website I have a button that prints a div via javascript, as it is it doesn't work, how can I make it possible?
my js code:
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
I can't seem to get net stream to work on my adobe air application. Android or desktop.
Here is the code with the valid link. The link works on VLC.
Any suggestions?
public function Main() {
url = "rtmp://s1p2w2yhnipjkt.cloudfront.net/cfx/st/mp4:demo.mp4?Expires=1594281188&Signature=AW0M39xRqX5bjhlw4EPMvdPzum8~gbK6Wsl7vkI3av6cWDXQ36lCfTlnpOXse6qiP9RSbuT-jhor84DHvZg7yPmvnnlPgAEQlndtgsBvzwUj~kGXES~~VWvHGVuUHTDnK~rAWcOmzpbRi-jWPpN71Ks2wnJeri596lqh2dOkUcg_&Key-Pair-Id=APKAI7XWAS4L22TVE3HA";
_netConnection = new NetConnection();
_netConnection.addEventListener(NetStatusEvent.NET_STATUS, onConnect);
_netConnection.client = {onBWDone:onNetConnectionBWDone};
_netConnection.connect(url);
_netConnection.connect("rtmp://s1p2w2yhnipjkt.cloudfront.net/cfx/st");
trace("connect")
}
private function onConnect(event:NetStatusEvent):void {
trace(event.info.code);
if(event.info.code == "NetConnection.Connect.Success")
{
_netStream = new NetStream(_netConnection);
_netStream.client = {onMetaData:onMetaData, onPlayStatus :onPlayStatus};
var video:Video = new Video();
video.attachNetStream(_netStream)
_netStream.play("mp4:demo.mp4");
addChild(video);
}
}
I tested your stream in my android device and it's working fine, and I think that your forgot to use the params with your stream, so you can do like this :
var url:String = 'rtmp://s1p2w2yhnipjkt.cloudfront.net/cfx/st',
// or rtmp://s1p2w2yhnipjkt.cloudfront.net:80/cfx/st
stream:String = 'mp4:demo.mp4?Expires=1594281188&Signature=AW0M39xRqX5bjhlw4EPMvdPzum8~gbK6Wsl7vkI3av6cWDXQ36lCfTlnpOXse6qiP9RSbuT-jhor84DHvZg7yPmvnnlPgAEQlndtgsBvzwUj~kGXES~~VWvHGVuUHTDnK~rAWcOmzpbRi-jWPpN71Ks2wnJeri596lqh2dOkUcg_&Key-Pair-Id=APKAI7XWAS4L22TVE3HA';
// ...
_netConnection.connect(url);
// ...
_netStream.play(stream);
Of course you have to add the INTERNET permission to your app to be able to get the stream, and also to be sure that your device can connect to the video server via the port 1935 or 80 (at worst).
Hope that can help.
I have created a RESTAPI in Node.js and trying it to invoke into my android application. But i am not able to make the request to the Node.js Rest API.
My code are as follows:
Node.js
var restify = require('restify');
var request = require('request');
var http = require('http');
var appContext = require('./config.js');
function labsAPI(jsonparseStr) {
return JSON.stringify(labsapi);
}
function searchbase(req, res, next){
var options = {
host: appContext.host,
path: appContext.path+req.params.name+appContext.queryString
};
cbCallback = function(response) {
var str = '';
response.on('data', function (chunk) {
str += chunk;
});
response.on('end', function () {
jsonparseStr = JSON.parse(str);
json_res = labsAPI(jsonparseStr);
res.writeHead(200,{'Content-Type':'application/json'});
res.end(json_res);
});
}
http.request(options, cbCallback).end();
}
var server = restify.createServer({name:'crunchbase'});
server.get('/search/:name',searchbase);
server.listen(appContext.port, function() {
console.log('%s listening at %s', server.name, server.url);
});
After running my code like : localhost:8084/search/name
I am able to return the output to the browser a valid Json.
Now i want to consume this web service into my android application , I am not able to figure out how to do it.
I tried some of the example
http://hmkcode.com/android-parsing-json-data/
In the above blog in MainActivity.java i changed my url to
new HttpAsyncTask().execute("http://127.0.0.1:8084/search/name");
but it is displaying nothing
127.0.0.1 is the IP address for localhost. From your browser localhost resolves to your computer, from your Android device localhost resolves to your Android device, but your node application isn't running on it.
You need to figure out what's your computer's remote address. LAN or WLAN would be enough as long as your on the same network as your Android device.
Also make sure firewall settings allow access to your computer.
in this code, i have tried to detect android browser and then redirect to another page. Its working fine in all mobile browser except “uc browser “ what will be code I have to add in this
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
if(isAndroid)
{
if (window.confirm("hi !!"))
{
window.location.href = "www.google.com"
}
}
Everything is working when open it with Opera mobile and Firefox, but when I open it with Android browser, the function not working. How to fix it?
$(document).ready(function(){
var price = document.getElementsByClassName('harga')[0];
var tax = document.getElementsByClassName('dp_per')[0];
var taxAmount = document.getElementsByClassName('dp')[0];
tax.onblur = function() {
taxAmount.value = parseFloat(price.value) * parseFloat(tax.value) / 100;
}
})(jQuery);
Here is what I've made:
http://jsfiddle.net/mYEUP/