Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-html5-audio

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-html5-audio - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

24

addon/components/html5-audio.js
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;
}
}
});

2

package.json
{
"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/).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc