New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@helga-agency/media

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@helga-agency/media

Audio component

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Audio

Audio component that consists of diffferent loosely coupled components that can (but must not) be used together.

Important

Load <audio-component> before all others, as the others will need a valid audio-component to set their models.

Example

All components are independent from one another. It, however, makes sense, to use at least <audio-component> and <media-play-pause-component> to get a working component.

    <audio-component data-source="file_example_MP3_700KB.mp3">
        <media-play-pause-component></media-play-pause-component>
        <media-time-component>0:00</media-time-component>
        <media-timeline-component>
            <!-- Timeline component must include an input[type="range"] -->
            <input type="range" value="0">
        </media-timeline-component>
        <media-time-component data-type="total"> -:-- </media-time-component>
        🔉<media-volume-component>
            <!-- Volume component must include an input[type="range"] -->
            <input type="range" value="100">
        </media-volume-component>
    </audio-component>

<!-- Import all components you use -->
    <script type="module" src="@joinbox/media/AudioComponentElement.js"></script>
    <script type="module" src="@joinbox/media/MediaPlayPauseComponentElement.js"></script>
    <script type="module" src="@joinbox/media/MediaTimeComponentElement.js"></script>
    <script type="module" src="@joinbox/media/MediaTimelineComponentElement.js"></script>
    <script type="module" src="@joinbox/media/MediaVolumeComponentElement.js"></script>

Components

Audio Component

Exposed Element

<audio-component></audio-component>

Attriutes
  • data-source: Path to the audio source file. It is only loaded when the user starts to play. Attribute must be set when the element is created as it is consumed by the element's constructor.
Properties
  • audio instance of HTMLAudioElement that is used to play the audio.
Styling
  • The audio-component element has an attribute data-state that is automatically updated when the state changes. The following values are used to reflect the component's current state:
    • initialized
    • loading
    • playing
    • paused

Media Play Pause Component

Exposed Element

<media-play-pause-component></media-play-pause-component>

Methods
  • toggle() toggles between play and pause.

Media Time Component

Exposed Element

<media-time-component></media-time-component>

Attriutes
  • data-type: either current to display the current playback time or total to display the audio's total duration. Defaults to current.

Media Volume Component

Exposed Element

<media-volume-component><input type="range"></media-volume-component>

input of type range is needed and the actual UI element.

Media Timeline Component

Exposed Element

<media-timeline-component><input type="range"></media-timeline-component>

input of type range is needed and the actual UI element.

FAQs

Package last updated on 09 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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