Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

injectBrowserKeyDown injectBrowserKeyUp for YouTube TV #1747

Closed
MrSol0 opened this issue Oct 23, 2020 · 10 comments
Closed

injectBrowserKeyDown injectBrowserKeyUp for YouTube TV #1747

MrSol0 opened this issue Oct 23, 2020 · 10 comments
Labels
enhancement New feature or request

Comments

@MrSol0
Copy link

MrSol0 commented Oct 23, 2020

Is your feature request related to a problem? Please describe.
Youtube TV has added a feature where you need to click Enter in order to watch a video with resume, however in my TV script, only the person with keys to the house can watch the TV and when Syncing the TV this issue happens as the script triggers a link with resume watch so everyone sees the same thing inside the house or Cinema, and both injectBrowserMouseDown and Up don't work in my case as the only key that works to press yes is Enter

Describe the solution you'd like
I want to be able to inject a key pressing for example injectBrowserKeyDown(browser,"Enter") or injectBrowserKeyUp(browser,"Enter")

Describe alternatives you've considered
i have tried both injectBrowserMouseDown, InjectBrowserMouseUp, i also tried navigateBrowserForward but it doesn't work.

Additional context
dialog

@MrSol0 MrSol0 added the enhancement New feature or request label Oct 23, 2020
@Dutchman101
Copy link
Member

Such a coincidence.. i've been breaking my head over this today. YouTube/Google really has no idea of what they are doing to certain applications using CEF and such technologies, every time they make some redundant little change.. It's not like you can set up stuff and never look back, it's high maintenance. It will always regularly break.

in this case, it's flagging CEF browser traffic as potentially automated, unusual. "Not a normal web user".

First it happened only to the classic YouTube interface (.com) and using .TV would bypass the dialog. But even more recently (perhaps a week or so?), they added it to .TV as well. Now there is no way to playback without the dialog if you're in CEF.

If we can somehow let MTA automatically submit "Yes", it would be much better, for all servers.

Also, that wouldn't be unusual - keeping YouTube working through all their changes is a pastime for MTA.. examples are e549fec, dd3931e, fa82ee7 so what I meant to say is that through history, MTA team has sort of decided to try and keep YouTube working out of the box.

Back on-topic, and to my intro words "i've been breaking my head over this today" - since I realized that injectBrowser functions weren't going to cut it, i intended to use https://wiki.multitheftauto.com/wiki/ExecuteBrowserJavascript by finding the element (perhaps involving Xpath) which is the "Yes" button in that dialog and crafting auto-submit javascript code. So then you'd have to execute that string every time a player is about to stream a new YT video.

That means it's probably not impossible to work around it with scripting, @MrSol0. But, back to my suggestion to fix it with MTA - how about injecting that javascript string using MTA CEF, so we can keep YouTube working as expected out of the box, the line of action we've already set course to like described.

@MrSol0
Copy link
Author

MrSol0 commented Oct 23, 2020

After checking and testing, i found this solution:
local width,height = 854,480 browser:injectMouseMove(width*.851,height*.375) browser:injectMouseUp('left')
"The numbers change depending on your browser's dimensions in createBrowser"
This works fine for me and solves the issue, i only had to put a 2 second timer before it gets excuted and that solved it. However i still believe this feature to be a great feature.

@qaisjp
Copy link
Contributor

qaisjp commented Oct 23, 2020

Hacking this to work out of the box seems reasonable to me 👍

@AlexTMjugador
Copy link
Member

I agree that we should support this out of the box, but really... I couldn't agree more with @Dutchman101's point about Google making breaking changes like this. It feels like MTA will keep playing a cat and mouse game forever. Would it be possible to get in touch with Google somehow so they stop flagging MTA traffic like "unusual" and potentially related with obscure behaviors?

@Woovie
Copy link
Contributor

Woovie commented Oct 23, 2020

No, they don't even trust CEF as a whole, let alone individual CEF projects.

@qaisjp
Copy link
Contributor

qaisjp commented Oct 23, 2020

I don't think they are specifically flagging MTA traffic. Their YouTube TV service is not intended to be used this way, and I strongly suspect that contacting them could cause problems.

@jushar
Copy link
Contributor

jushar commented Oct 28, 2020

Any idea what conditions need to be met so that the dialog pops up? Perhaps spoofing the useragent is sufficient.

@mahlukat5
Copy link

mahlukat5 commented Oct 29, 2020

Im using cinema (cinemaexperience) script.. and i got this error
and im changed s-main.lua:16
before:
local url = "https://www.youtube.com/tv#/watch?v="..id.."&resume"
after:
local url = "https://www.youtube.com/embed/"..id.."?modestbranding=1&autohide=1&showinfo=0&controls=0&autoplay=1&volume=0"
its working like this.

and you need change c-main.lua:248 like this:
loadBrowserURL(Screen,tostring(url).."&start="..atTime)

@MrSol0
Copy link
Author

MrSol0 commented Oct 29, 2020

well this ticket is for https://www.youtube.com/tv#/ not embed, as much as i understand it but i want the original youtube TV view instead of creating a custom one where the player has to insert video id. but thanks

@patrikjuvonen patrikjuvonen changed the title injectBrowserKeyDown injectBrowserKeyUp for Youtube TV injectBrowserKeyDown injectBrowserKeyUp for YouTube TV Jan 7, 2022
@MrSol0
Copy link
Author

MrSol0 commented May 21, 2022

Currently youtube has changed to "Are you watching now?" and i solved it by doing setTimer(function() browser:injectMouseMove(width*0.9,height*0.9) browser:injectMouseUp('left') end,500,1)

@patrikjuvonen patrikjuvonen closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants