Giter VIP home page Giter VIP logo

Comments (5)

f1u77y avatar f1u77y commented on September 4, 2024

Sorry, Gruntfile.js is a mess now. I'll try to fix it.

from web-media-controller.

doronbehar avatar doronbehar commented on September 4, 2024

Thanks. As for the invidio.us support I'd like to contribute, I was wondering whether you could help me a little bit getting inside the code. I have a question:

I'm trying to understand the way a connector works by reading the existing ones. As I see, the most important variables in a connector are the selectors I. If I give a selector (take nextButtonSelector for example) a value of div#continue and the first link inside it will lead to the next video, should it be good enough or should I find a selector that will lead straight to a link that targets the next video?

from web-media-controller.

f1u77y avatar f1u77y commented on September 4, 2024

If I give a selector (take nextButtonSelector for example) a value of div#continue and the first link inside it will lead to the next video, should it be good enough or should I find a selector that will lead straight to a link that targets the next video?

You could see content/base-connector.js to make a better idea of what happens there. In this case, when next signal comes from outside, connector.next() is called. Its implementation in base-connector.js among other things tries to get the first element that matches nextButtonSelector and then tries to call elem.click(). If there is no click()able element, you could just implement next() from scratch in your connector.

from web-media-controller.

f1u77y avatar f1u77y commented on September 4, 2024

I've also fixed Gruntfile.js and corresponding README info.

from web-media-controller.

doronbehar avatar doronbehar commented on September 4, 2024

I've also fixed Gruntfile.js and corresponding README info.

Cool.

You could see content/base-connector.js to make a better idea of what happens there. In this case, when next signal comes from outside, connector.next() is called. Its implementation in base-connector.js among other things tries to get the first element that matches nextButtonSelector and then tries to call elem.click(). If there is no click()able element, you could just implement next() from scratch in your connector.

Wonderfully explained. One more question please regarding the mediaSelector: I tried to set it to just video with the hope that it will eventually make the playPause() functions work just like in YouTube but it didn't work.

However, I've managed to test the addEventListener in the console like so:

document.querySelector('video').addEventListener("pause", function(){ console.log("paused")})

I've also tried to use playButtonSelector without success while I did managed to run this in the console:

document.querySelector('.vjs-play-control').click()

According to your explanation, both of these console tests should simulate what the extension does only with a few wrappers from content/utils.js right?

from web-media-controller.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.