ember-html5-audio
Advanced tools
Comparing version 0.1.0 to 1.0.0
import Ember from 'ember'; | ||
import InboundActions from 'ember-component-inbound-actions/inbound-actions'; | ||
/* | ||
* Wraps an HTML5 audio element. | ||
* | ||
* Input: | ||
* - src: the source of the audio file. | ||
* | ||
* Events (see https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events): | ||
* - durationChange: sent on `durationchange` event (https://developer.mozilla.org/en-US/docs/Web/Events/durationchange) | ||
* - loadedMetadata: sent on `loadedmetadata` event (https://developer.mozilla.org/en-US/docs/Web/Events/loadedmetadata) | ||
* - ended: sent on `ended` event | ||
* - timeUpdate: sent on `timeupdate` event (https://developer.mozilla.org/en-US/docs/Web/Events/timeupdate) | ||
* | ||
* Actions: | ||
* - play | ||
* - pause | ||
* - seek | ||
* | ||
*/ | ||
export default Ember.Component.extend(InboundActions, { | ||
@@ -49,5 +67,2 @@ tagName: 'audio', | ||
actions: { | ||
seek: function(position) { | ||
this.$()[0].currentTime = position; | ||
}, | ||
play: function() { | ||
@@ -58,4 +73,7 @@ this.$()[0].play(); | ||
this.$()[0].pause(); | ||
}, | ||
seek: function(position) { | ||
this.$()[0].currentTime = position; | ||
} | ||
} | ||
}); |
{ | ||
"name": "ember-html5-audio", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"description": "Ember.js component that serves as a HTML5 audio element.", | ||
@@ -5,0 +5,0 @@ "directories": { |
# Ember-html5-audio | ||
This README outlines the details of collaborating on this Ember addon. | ||
Ember.js addon that wraps an HTML5 audio (`<audio>`) element and "Emberizes" the events (`loadedmetadata`, `ended`, `durationchange`, etc...) that it sends. | ||
## Installation | ||
## Installing | ||
Install as an Ember-CLI addon: | ||
ember install ember-html5-audio | ||
## Usage | ||
// templates/some-template.hbs | ||
{{html5-audio | ||
src="https://link-to-audio-file.ogg" | ||
durationChange=(action 'onDurationChange') | ||
loadedMetadata=(action 'onLoadedMetadata') | ||
ended=(action 'onEnded') | ||
timeUpdate=(action 'onTimeUpdate') | ||
actionReceiver=html5Audio | ||
}} | ||
### Input | ||
Arguments for the component: | ||
* _src_ | ||
### Events | ||
It implements some of the events for media elements (see https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events). Please fork and PR if you want to add more supported events. | ||
* _durationChange_: sent on `durationchange` event (https://developer.mozilla.org/en-US/docs/Web/Events/durationchange) | ||
* _loadedMetadata_: sent on `loadedmetadata` event (https://developer.mozilla.org/en-US/docs/Web/Events/loadedmetadata) | ||
* _ended_: sent on `ended` event | ||
* _timeUpdate_: sent on `timeupdate` event (https://developer.mozilla.org/en-US/docs/Web/Events/timeupdate) | ||
### Actions | ||
We allow actions to be sent to the audio element through the [ember-component-inbound-actions](https://github.com/GavinJoyce/ember-component-inbound-actions) addon. Supported actions: | ||
* _play_ | ||
* _pause_ | ||
* _seek_ | ||
## Building yourself | ||
* `git clone` this repository | ||
@@ -11,7 +50,2 @@ * `npm install` | ||
## Running | ||
* `ember server` | ||
* Visit your app at http://localhost:4200. | ||
## Running Tests | ||
@@ -22,7 +56,1 @@ | ||
* `ember test --server` | ||
## Building | ||
* `ember build` | ||
For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8264
132
1
55