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

playbackRate support #1132

Closed
wants to merge 18 commits into from
Closed

playbackRate support #1132

wants to merge 18 commits into from

Conversation

H1D
Copy link
Contributor

@H1D H1D commented Apr 7, 2014

this fixes #840

But unfortunately I broke tests and don't know how to fix them =(
at file:///Users/user/proj/video.js/test/unit/player.js:41: The "playbackRate" method is not available on the playback technology's API

var rate = this.player_.tech.playbackRate() + 'x';
return vjs.Component.prototype.createEl.call(this, 'div', {
className: 'vjs-playback-rate vjs-menu-button vjs-control',
innerHTML:'<div class="vjs-playaback-rate-value">' + rate + '</div>'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

playaback -> playback

@heff
Copy link
Member

heff commented Apr 14, 2014

Great stuff, thanks! Digging into it now.

player.on('loadstart', vjs.bind(this, function(){
// hide playback rate controls when they're no playback rate options to select
if (( player.tech.features && player.tech.features['playbackRate'] === false) ||
this.player_.options_.playbackRates.length === 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any var with an underscore at the end is a private var, so you should really never have two in the same reference. i.e. this should be this.player().options().playbackRates.length === 0.

@heff
Copy link
Member

heff commented Apr 14, 2014

Great job figuring out all the pieces for getting this to work! If you want to make the suggested changes I should be able to pull it in.

@jnwng since you were looking into implementing this, does it do what you were hoping it would?

@heff heff added the confirmed label Apr 14, 2014
@jnwng
Copy link
Contributor

jnwng commented Apr 14, 2014

yeah, i forked @H1D's work here and have the bare playback API working as expected. we've been using this internally already as the changes we added for playbackRate support were merged on our own fork a while ago, just took a while to come around to getting this upstream. we use an alternative front-end component for access the playbackRate, so i haven't had a chance to look at the one presented here.

i do have a few test additions that i've made on the fork, which i'll work with @H1D to get merged into his fork before bringing it all back here to master.

@jnwng
Copy link
Contributor

jnwng commented Apr 14, 2014

@H1D have an open pull with an additional playbackRate test to add to this

@heff
Copy link
Member

heff commented Apr 15, 2014

Awesome, thanks.

Adding test for playbackRate API functionality
@H1D
Copy link
Contributor Author

H1D commented Apr 15, 2014

cool!
@heff I'll try to follow suggestions you've made to finish this. Give me a day or two.

@heff
Copy link
Member

heff commented Apr 15, 2014

Great, thanks!

@H1D
Copy link
Contributor Author

H1D commented Apr 21, 2014

@heff I did what you suggested. Tests still fails =(

@mmcc mmcc mentioned this pull request May 2, 2014
@H1D
Copy link
Contributor Author

H1D commented May 7, 2014

damn. Tests are passing but UI is broken. Do not merge this

};

vjs.PlaybackRateMenuButton.prototype.playbackRateSupported = function(){
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a little too fancy here. :) Should remove the line break after return.

@heff
Copy link
Member

heff commented May 7, 2014

Sorry about that... I made some comments that I think should fix it.

@heff heff closed this in 8dfe0a4 May 13, 2014
@heff
Copy link
Member

heff commented May 13, 2014

This is now fixed and merged into master. I changed it so the playback rates don't show by default because I'm not sure if playback rate is something that everyone wants in their player. This at least lets us see how popular it becomes before making it the default.

To add playback rates, supply the playbackRates option. e.g.

videojs(my_id, { playbackRates: [0.5, 1, 1.5, 2] })

@isdito
Copy link

isdito commented May 13, 2014

Hello.
It is in version 4.5.1 ? videojs(my_id, { playbackRates: [0.5, 1, 1.5, 2] })
Thank you

@heff
Copy link
Member

heff commented May 14, 2014

No, it will be in 4.6.0, which will be released in the next few days.

@isdito
Copy link

isdito commented May 14, 2014

Thank you.

@H1D
Copy link
Contributor Author

H1D commented May 14, 2014

That's great! Thx for finishing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support playbackRate and defaultPlaybackRate
5 participants