Skip to content

The value 0 cannot be passed as a parameter in tubeplayer calls #22

@fruchtose

Description

@fruchtose

There are a couple bugs in tubeplayer regarding the handling of the value 0. For instance, let's say you write the following code:

$("#player").tubeplayer('volume', 0);
}

The output of this call will be 100, indicating that YouTube's volume will be 100, rather than 0. The reason is that, in the definition of $.fn.tubeplayer we see the following line:

return $this.triggerHandler( input+TUBEPLAYER, xtra || null );

If the variable xtra is 0, then 0 || null evaluates to null.

Additionally, in the volume key of the PLAYER object, the branch to use the passed-in parameter runs the following if-statement:

if (param) {

This branch will ignore 0, so a better if-statement would read,

if (param != null) {

This bug prevents tubeplayer from fully encapsulating the JS YouTube API. The API specifies that the volume may be set between 0 and 100. tubeplayer, however, allows the values 1 through 100 instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions