Git Product home page Git Product logo

Comments (2)

ScottDowne avatar ScottDowne commented on July 29, 2024

I tried this ages ago, and found that in most cases getAvailablePlaybackRates would only return an array of 1. :(

from popcorn-js.

jmgirven avatar jmgirven commented on July 29, 2024

I'm not sure if you guys ever got this working or not, but I was just experimenting with this too. In popcorn-complete.js 1.5.6, HTMLYouTubeVideoElement, line 6479: Object.defineProperties, I just added a getter and setter for playbackRate and getAvailablePlaybackRates:

  playbackRate: {
    get: function() {
      return player.getPlaybackRate();   
    },
    set: function( aValue ) {
      player.setPlaybackRate(aValue);
      self.dispatchEvent( "ratechange" );
    }
  },

  availablePlaybackRates: {
    get: function() {
      return player.getAvailablePlaybackRates();
    }
  },

The videos I have been looking at tend to have available playback rates of [0.25, 0.5, 1, 1.25, 1.5, 2]. I know YouTube doesn't provide this for all videos though, so you should check the list before setting a new playbackRate.

You can then change the playbackRate using e.g:

var rate = popcornElement.media.availablePlaybackRates[0];
popcornElement.media.playbackRate = rate;

Does that work for you too?

from popcorn-js.

Related Issues (20)

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.