add playbackrate as binding for mediaelements (#2202)

pull/2328/head
Lukas 6 years ago
parent e527b0424a
commit 8eb8c707b1

@ -534,7 +534,8 @@ export default class Element extends Node {
name === 'buffered' || name === 'buffered' ||
name === 'seekable' || name === 'seekable' ||
name === 'played' || name === 'played' ||
name === 'volume' name === 'volume' ||
name === 'playbackRate'
) { ) {
if (this.name !== 'audio' && this.name !== 'video') { if (this.name !== 'audio' && this.name !== 'video') {
component.error(binding, { component.error(binding, {

@ -445,6 +445,7 @@ const attribute_lookup = {
], ],
}, },
volume: { applies_to: ['audio', 'video'] }, volume: { applies_to: ['audio', 'video'] },
playbackRate: { applies_to: ['audio', 'video'] },
width: { width: {
applies_to: ['canvas', 'embed', 'iframe', 'img', 'input', 'object', 'video'], applies_to: ['canvas', 'embed', 'iframe', 'img', 'input', 'object', 'video'],
}, },

@ -139,6 +139,7 @@ export default class BindingWrapper {
break; break;
case 'currentTime': case 'currentTime':
case 'playbackRate':
case 'volume': case 'volume':
update_conditions.push(`!isNaN(${this.snippet})`); update_conditions.push(`!isNaN(${this.snippet})`);
break; break;

@ -83,7 +83,14 @@ const events = [
filter: (node: Element, name: string) => filter: (node: Element, name: string) =>
node.is_media_node() && node.is_media_node() &&
name === 'volume' name === 'volume'
} },
{
event_names: ['ratechange'],
filter: (node: Element, name: string) =>
node.is_media_node() &&
name === 'playbackRate'
},
]; ];
export default class ElementWrapper extends Wrapper { export default class ElementWrapper extends Wrapper {

Loading…
Cancel
Save