StaceyKosheen
StaceyKosheen

Reputation: 21

Uncaught (in promise) TypeError: player.mute is not a function

I add the event listener to the dailymotion playlists. I want to implement the following: When the event catches, get the information about the related playlist and mute it.

    // Define the callback function
const callback = (state) => {
    var player = dailymotion.getPlayer(state.id).then((player) => {
    player.mute()
    });
}

// Get access to all embedded player instances on the page
Promise.all(dailymotion.getAllPlayers()).then((players) => {
    // Add an event listener to each player for the 'PLAYER_START' event
    players.forEach((player) => {
        player.on(dailymotion.events.PLAYER_START, callback)
    });
})

I get: Uncaught (in promise) TypeError: player.mute is not a function

Upvotes: 1

Views: 146

Answers (1)

StaceyKosheen
StaceyKosheen

Reputation: 21

I tried what was proposed by @James and @Barmar:

dailymotion.getPlayer(state.id).then((player) => {
   player.setMute(true)
});

And that worked.

Upvotes: 1

Related Questions