Running an app from the browser, and detecting if the app is installed or not - browser

In my web app, I want to discover devices on the local network. The devices announce themselves with mDNS (Bonjour) and from everything that I read, It's impossible to go deep enough in the network layer and detect these devices from the browser.
However I can do that from a Desktop app. Thus, what I need is running a Desktop app from a custom URI. There is a lot of documentation about that, like this article. But if the user do not have the app, the link just does nothing.
I noticed that a lot of apps like slack, discord, etc. that redirect to their desktop app do not provide dead links if you don't have the app installed. If you don't have the app, they make you download and install it.
How do they achieve this ?
Thank you for reading !

Related

How to build web application that run in WeChat in app browsers?

I am trying to build a simple web application, which capture users photo and sent it my custom server there by connected to some other business use-case. My web page uses HTML's file input control to launch native camera or gallery pick up option.
var input = document.createElement('input');
input.setAttribute('accept', 'image/*');
input.setAttribute('capture', 'camera');
input.setAttribute('type', 'file');
input.click();
This web app, I placed in local webserver with a name "PhotoLocker" and testing with url like
https://localhost(ipaddress to access via mobile browser)/PhotoLocker/index.html
This link is working fine both on desktop and mobile chrome browsers and am able to debug any issues. Where as same link, I try to access from WeChat browser (just opening above link from chat window), it is not at all opening my application in WeChat in app browser.
After googling, I found that https URL scheme is not supported by WeChat. is it True? When I paste the same app url as weixin://ipaddress/PhotoLocker/index.html, I am able to see my web app home page but it is not working as expected.
My Question is - how to debug my webpage opened in WeChat browser? Do I need a official WeChat Dev account even to develop and test sample apps?
Additional Info :
I am able to debug webpage from WeChat web devloper tool as mentioned in below link. But, unable to debug mobile wechat page in this tool. It is always opening chrome dev tools.
https://mp.weixin.qq.com/wiki?action=doc&id=mp1455784140&t=0.06697335132505233#1
I am a frontend developer in China, Chinese. Forgive my English for any mistake, misunderstanding I could make. Some links (dev docs mostly) below contain sites complete in Chinese, because I can not find corresponding English ones for now.
how to debug my webpage opened in WeChat browser?
Tencent provide an IDE for developing regular web interface and WeChat-mini-program, with which developer can directly interact with:
JSSDK (basically a special weixin
Object lives only in in-WeChat-browser);
API provided in WeChat-mini-program.
If you download that IDE:
First it will ask you is to use you WeChat to scan the QRCode, then confirm login with your WeChat account;
Next it will show up two square button (image below), left one is for WeChat-mini-program, the right one is for you to testing regular web page.
Click the right blue one, then you can find your way out, it's just something built top on project Blink.
As you can see the part of debugging regular webpage in WeChat IDE is no more than a simulator (in the WeChat-mini-program part, developer can write code directly in it), and in my experience it does have bugs, you will still need to test code in real machine.
For that Tencent provide another tool called vConsole, tutorials here, with it you can do following things directly in in-WeChat-browsers:
View console logs;
View network requests;
View document elements;
View Cookies and localStorages;
Execute JS command manually
and so on
Do I need a official WeChat Dev account even to develop and test sample apps?
Depends.
You may know the Official Account inside WeChat, with webpages directly opened in any context inside in-WeChat-browser, it will have the ability to interact the weixin Object, or have some API like login with WeChat, pay with WeChat Pay:
API like close current in-WeChat-browser, hide-share-button will not required anything special, you don't need to register any Official Account;
But if you want yo do the Pay, Login thing, you need an Official Account and pay for the ability every year (not sure about this outside China).
The localhost problem you faced
I don't have my working machine with me now so I can not test. Regularly I can proxy localhost with Charles then debugging in WeChat, but never do the https, I will try it later.
All the information got regarding how to debug webpage opened in wechat browser redirects to how to see log or ajax/netwrok calls analysis.
Even with WeChat web devloper tool as mentioned in below link, I am unable to debug mobile wechat page in this tool. It is always opening chrome dev tools.
https://mp.weixin.qq.com/wiki?action=doc&id=mp1455784140&t=0.06697335132505233#1.
Hence further analyzed remote mobile webpage debugging and found that there is no way to put break points, watch, expressions and all just like in chrome dev tools is not possible.
As a work around - you are able to debug code, when you simulate page in dev tools but no way to debug webpage in mobile device.
Same webpage when tried to do remote debugging as per WeChat web devloper tool documentation. here we can only see console logs and network calls.

Can i use Chromecast as a server?

Studying the possibility to achieve the following:
We have a CMS that from time to time posts to a web hook a media URL (video) (public internet hosted)
This web hook post we would like to post directly to a ChromeCast which is plugged in to a TV
Questions:
1. Can a web server like nodeJS be installed on a chrome cast?
2. Is it possible to use for example DynamicDNS to link the Chromecast to a domain name so the post from the web hook can be made?
ChromeCast has a sender API which allows you to "send" content to a specific Chromecast. Right now, the sender API works on Android, IOS and Chrome OS. You can read more about it here: https://developers.google.com/cast/docs/sender_apps.
And, here's how a receiver application that would receive your content on the ChromeCast would work: https://developers.google.com/cast/docs/receiver_apps or if you're content is a standard type, then you can use a prebuilt receiver application without building your own.
To answer your specific questions:
Can a web server like nodeJS be installed on a chrome cast?
No, not without enormous hacking and development yourself to basically take over the hardware somehow and get your own stuff to run on it.
Is it possible to use for example DynamicDNS to link the Chromecast to
a domain name so the post from the web hook can be made?
Not that I know of.
The chromecast has an android like google chrome operating system. It is possible to root it, but you will not be able to (to my knowledge) get a server on it. I would suggest taking a look at the Raspberry Pi. You should be able to run a slim server on it. After you get that set up it might be feasible to pass command line commands to chrome or another web browser to display the data you like. A browser is not necessary, but I'm not sure if you know of any other way to display the media.
A different approach would be to have a server anywhere (could be in your home) and have something like the raspberry pi (any computer for displaying the content) connect to a webpage hosted with that server. Using websockets something like socket.io, you could set it up so that the server could send messages (url of video) to the browser session you have open. The javascript of your webpage would then use that message to open that url.

Remote control a Chrome Extension

I've written a non-published (personal) Chrome extension that performs page checking and then performs actions such as opening new tabs if certain conditions are met. I would like to be able to "remote control" it from my phone though, e.g. turn on or off or adjust settings when I'm away from my desk.
I considered if the extension can read/write to a file in Dropbox, which I could then edit from my phone too, or any other device. But I'm not sure if extensions are allowed to arbitrarily read/write in the filesystem, or only "apps". Any other suggestions?
Assuming you can't directly connect to your computer (otherwise wOxxOm's answer is valid)..
You could make a companion phone app and use GCM push messages; your phone would message your server via it (which can be hosted on a free App Engine tier easily if it's just for your private use) and the server will push out the message.
Though it'll probably be much easier to just have said App Engine server up and providing a WebSocket endpoint that your extension can connect to to receive commands in real-time, and some sort of API / control panel on the web (authenticated, of course).
Any free webserver-based solution would lag, as bad as 500ms, I think.
Try making a complementary native PC program: mobile apps for remote control usually have their PC part running as a background service or an application with just a shelltray icon. Such program opens a TCP/UDP port on PC and listens for commands from the mobile app, and can communicate with your extension via Chrome's native messaging API.

Why am I getting a LAUNCH_ERROR, NOT_FOUND when attempting to play to an audio-only Google Cast device?

I recently purchased a LG Music Flow H3 to test my Google Cast app with an 'audio-only' device. I've enabled audio-only device support within the Google Cast Dashboard and I've registered the device for development. My app works as expected when played to Google Chromecasts, however when attempting to load the receiver app on the LG device I get the following error:
{"reason":"NOT_FOUND","requestId":1,"type":"LAUNCH_ERROR"}
Thinking that perhaps 3rd-party devices can't be registered for development, I went ahead and published my app. Unfortunately this did not address the problem.
Upon further investigation, I'm noticing that other Google Cast apps (i.e. Songza, TuneIn, Pandora, etc. on both Android & iOS) aren't able to play to the LG Music Flow H3 either.
I discovered that the only way to get the H3 to play from Google Cast apps (both my app and others) is to first run the LG Music Flow multi-room audio app. Running the LG Music Flow app appears to effect the device's _googlecast._tcp zeroconf service discoverability. And sometimes the H3 shows up in zeroconf yet you still can't play to the speaker unless the LG Music Flow app is running.
This seams like very strange behavior. I called LG Tech Support, and they recommended I return the device and exchange it for a different one. I did this, and I still get the same result.
Is this how Google Cast on 3rd-Party devices is intended to work? Have I encountered a buggy 3rd-party implementation?
This is not the intended behavior for sure. You are supposed to be able to launch your 3rd party application on the speaker.
And it works for me.
The fact you are not able to use any other 3rd party apps (TuneIn, Pandora etc) indicate this is a some general problem and not specifically with your app.
Couple of steps I would try:
- Setup you H3 speaker on Wifi (vs Ethernet) and get the latest SW version using the Music Flow app.
Have you Factory reset the device? if you did, you will need to go through setup again. I have noticed Google Cast becomes enabled only after first complete setup.
Please try rebooting, and than try casting apps like TuneIn or Pandora and than see if this works (without using the MusicFlow app). I have noticed in the past that if some app is loaded and is behaving badly (for example uses tons of memory) it will put the speaker into a bad state that don't allow any app to work until reboot. So perhaps when you are casting your app, it gets into a bad state causing other apps to fail afterwards.
Have you made sure not to consume to much memory? avoid graphics or video?

WebRTC Streaming between PC and Mobile Client

I would like to implement peer to peer communication between mobile device (iOS & Android) AND Windows PC, I would like Mobile app will stream camera output to PC(no audio will require), and on PC user will able to capture screenshot from running steam. Below is possibility I am thinking.
Option 1 : Develop a Web based application which will run in Google Chrome or Firefox browser on Windows PC, and also will develop mobile client app which will run on Android and iOS devices, and using WebRTC it will steam mobile camera output to website which will be running in PC’s Chrome or Safari browser, and User will able to capture screenshot from running steam and that will be saved on user’s computer. Drawback of this solution is that I have to develop Website so will have not user’s computer file storage, as standalone desktop application is more preferable because desktop application will able to easily access user’s computer file system
Option 2: Develop 3 applications
one Standalone desktop application which will have all features which require to access computer’s local file system.
Develop a small web site which will have just a single screen, it will use for display mobile camera steam, and user will capture output from that page, will develop a kind of watchdog service in desktop app, which will grab latest captured screen from Chrome or Firefox browser.
3rd app would be mobile client which will be running on mobile which will stream camera output to PC using WebRTC. Drawback of this solution is that this solution would be not real-time, because user have to use two separate interface for Screen capture have to use PC Chrome or Firefox browser, and after screen capture have to move back to PC application.
My understanding is that It’s not possible to have Server less solution for WebRTC, Signaling server will require, I found some of open source WebRTC servers i.e. Easyrtc, signalmaster which I have to use and have to configure in own environment.
As this is my first WebRTC based project, so would like to know your opinion about Solution which i am thinking, is it right or is there any better way to achieve it.
Thanks
Suresh
Hi suresh IOS not support WebRTC,But its possible in android
My option is Node-webkit(desktop app using HTML 5,Javascript,css3,Nodejs,NPM)
https://github.com/rogerwang/node-webkit/wiki
mobile app(intel xdk ) but ios not support WebRTC
http://xdk-software.intel.com/
You could use Twilio Video to do this.
You can build multi-party video calling into both web and native applications with the SDKs for:
JavaScript
iOS
Android
https://www.twilio.com/docs/api/video
You will also find the server-side starter apps in various languages you need to get started quickly.
In my preferred language example Python, a small Flask app handles token creation to handle user access for video conversations in app.py and the basic WebRTC functions can be found in quickstart.js.
Note: I work for Twilio.

Resources