prevent audio restarting when it reaches the end

pull/496/head
Rich-Harris 9 years ago
parent fffd9ffd64
commit ed1ac48c00

@ -99,7 +99,12 @@ export default function visitBinding ( generator, block, state, node, attribute
} }
else if ( attribute.name === 'paused' ) { else if ( attribute.name === 'paused' ) {
updateElement = `${state.parentNode}[ ${snippet} ? 'pause' : 'play' ]();`; // this is necessary to prevent the audio restarting by itself
const last = block.getUniqueName( `${state.parentNode}_paused_value` );
block.builders.create.addLine( `var ${last} = true;` );
updateCondition += ` && ${last} !== ( ${last} = ${snippet} )`;
updateElement = `${state.parentNode}[ ${last} ? 'pause' : 'play' ]();`;
} }
} }

Loading…
Cancel
Save