Get a Cast button on YouTube for a custom cast solution - casting

Recently I have made a Custom local Flask website to cast from a local device to a RPi4 Connected to my TV. There is a GUI and it is also controllable by GET requests, the main way that the casting works, is in fact passing data from js to python via GET Requests.
It is easy to control but still getting to the main question here:
Is it possible to have a cast button on youtube for my solution? To trick youtube into thinking it is a chromecast or any other way? After pressing the cast button on youtube it would in some way go to my solutions address and pass along the Video URL as a GET Request.
Anyone knows is this possible?

Try setting up a TV emulator by reprogramming an old smartphone to appear as a tv for network and relay all screen mirroring request data to your server with a get request. That's what I'd do.

Related

Interact with web browser using Qt/bash script?

I frequently need to access to the router to do some simple task: restart, switch on/off some options... And the repeated process really annoying me :(
I want to write a batch script/program which do it for me.
I can't flash the router with the DD-WRT firmware to access it via console. The policy don't allow it.
Then I come up with an idea that use Qt write a small program which will interact with the browser. Access the router IP, fill the password, browse to the option page...
However, AFAIK, I can only do such thing with a web-driver like selenium, which is unavailable with Qt.
So is there any solution? I really like the idea use Qt or a script to solve the problem.
Any ideas are appreciated :)
It is possible to just send form response and don't load the page in the QWebFrame. You can use some tool (firebug, wireshark) to catch the request/response when you click "save" and learn what to send to your router everytime you want this configuration. It will be simple HTTP GET or POST request. That request can be done with curl, wget or your simple QT application using QNetworkRequest or wethewer.
It will be more tricky if it needs authentification other then HTTP basic auth. You will need two requests
first one - authenticate and save all cookies
second one - set parameters and add all cookies to response

Add video to timeline from GDK or Add "Share" to live card

I'm using the GDK with XE16
I would like to save a video using MediaRecorder and then put it on the Timeline so I can let the user share the video to Gplus, YouTube or any contact. I am providing some additional information during the recording process as an overlay on the video preview.
I am able to save the videos into the /mnt/sdcard/Movies path. I am invoking the Intent.ACTION_MEDIA_SCANNER_SCAN_FILE to add the recorded video to the media database.
I have not been able to figure out how to add a share intent to on livecard. The previous API supported static cards, but those did not support video attachments; and the API is no longer available. I have also tried to use AccountManager and the com.google account in Glass to get an ouath token for the Mirror api to write direction via oauth2:https://www.googleapis.com/auth/glass.timeline. The authorization request shows up, but it is impossible for the user to accept the request.
I've considered sending the video file back to a proxy server that will then call mirror, but this seems like a big round trip for nothing.
I suppose I could send the credentials through this proxy, but this seems like a security nightmare.
The difference between Static Cards and a Timeline Item were large enough that the team, apparently, removed Static Cards until they could make the two of them work much more similarly. What you're trying to do is a commonly requested, and it does make sense that both should work mostly the same way.
You're on the right track for how to handle this at the moment - use the Mirror API to get it into the timeline as a Timeline Item. As you've noticed, you can't go through the auth flow since the user is unable to authenticate through Glass directly.
While you're testing, you can code in an auth token and a refresh token to be provided to the library to do this. For production through MyGlass, take a look at the auth flow that is available at https://developers.google.com/glass/develop/gdk/authentication

Using a web site button control via C/++

I use www.jango.com as PC music player and want to steer it remotly via my smartphone. I have a server program for controling the PC and an app as client.
I want to use the server program for example to press the play/pause or fast forward button in jango.com running inside the chrome webbrowser.
A simple way would be to simulate a windows mouse click at a specified position within the chrome window. But it would have the disadvantage that it would only work if the jango tab is active and will of course fail if the site changes it's layout and probably due to a lot other reasons.
So I'm thinking about generating kind of the same http request as the browser does if one clicks the button for real. Or somehow accessing the html elemnt
Please consider thatm while having a C/++ background, I lack any web/JS programming skills and would be in favor keeping it this way as much as possible.
Thank you for any suggestions!
The solution is to use an user script for the musik player web site which is able to trigger the buttons in question. Than websockets can be used to communicate between the user script and the c++ server program.

HTML5 Canvas to Facebook

I've made a basic HTML5/JS comic creation tool that uses the canvas element.
I want users to be able to upload their comics via the Facebook API.
I don't believe Facebook allows posting images in the form of base64 strings from the canvas.toDataURI() method, and don't want to use my own server to convert these images & temporarily store them.
What's the best way to go about this? Possibilities I've wondered about: Convert canvas to blob? Store blob via web service (if so, suggestions?) Upload blob directly to Facebook? (Is that possible?)
I don’t see why this should not be possible doing a „normal” upload. You can create a new photo for a user by posting to PROFILE_ID/photos, with a source parameter of type multipart/form-data.
So first thing I’d try is getting the picture info from the canvas object into a „normal” form (writing it into a input element in the right format(?)), and sending that to Facebook. If this step succeeds, I’d see if jQuery or some other lib’s form.serialize method can build requests of type multipart/form-data. If that’s also possible, then there should be no further problem in taking the data in that format and posting it using FB.api (although you might want to tell your users to be patient, because that might take a while).
Can’t tell for sure if this’ll work, but I’d give it a try.
Facebook partners with Heroku for free app hosting, you can use it as the temporary server.

Can IWebBrowser2 store cookies in a user specified folder?

I am working on a small web browser on c++ using IWebBrowser2, the problem is that when I delete cookies on my browser, they get deleted for IE, and I dont want to interfere with IE cookies. Is there a way to solve this?
IWebBrowser2 is Internet Explorer, so you're not really writing another browser. You're just writing a browser host that is re-hosting the Trident rendering engine. and associated plumbing. So unless I'm completely off base here (anyone?) the answer is a resounding "no."
-Oisin