Last active
August 29, 2015 14:07
-
-
Save amiuhle/0aca4eb299af53724ed1 to your computer and use it in GitHub Desktop.
designer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> | |
<link rel="import" href="../paper-icon-button/paper-icon-button.html"> | |
<link rel="import" href="../paper-input/paper-input.html"> | |
<polymer-element name="audio-player" attributes="audioUrl" audiourl="http://swr-mp3-m-swr3.akacast.akamaistream.net/7/720/137136/v1/gnl.akacast.akamaistream.net/swr-mp3-m-swr3"> | |
<template> | |
<style> | |
</style> | |
<link rel="stylesheet" href="audio-player.css"></link> | |
<audio id="player" src preload="metadata"></audio> | |
<core-toolbar id="core_toolbar"> | |
<paper-icon-button icon="menu" id="core_icon_button"></paper-icon-button> | |
<paper-input label="URL" willvalidate value="{{ audioUrl }}" type="url" id="url" flex name="url" layout vertical></paper-input> | |
<paper-icon-button icon="{{ playerIcon }}" id="playPause" on-click="{{ playPause }}"></paper-icon-button> | |
</core-toolbar> | |
</template> | |
<script> | |
Polymer({ | |
playPause: function () { | |
if(this.$.player.paused) { | |
this.$.player.play(); | |
} else { | |
this.$.player.pause(); | |
} | |
}, | |
get playerIcon() { | |
console.log('playerIcon', this.$ && this.$.player.paused); | |
if(this.$ && this.$.player) { | |
return this.$.player.paused ? 'av:pause' : 'av:play-arrow'; | |
} | |
return 'av:play-arrow'; | |
} | |
}); | |
</script> | |
</polymer-element> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment