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

@mebtte/react-media-session

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mebtte/react-media-session

The react component that wraps MediaSession.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
73
increased by46%
Maintainers
1
Weekly downloads
 
Created
Source

react-media-session

The react component that wraps mediaSession.

What is MediaSession

  • MDN
  • Google

Requirement

  • react >= 16.8 with hook

Installation

npm install --save @mebtte/react-media-session

Usage

import MediaSession from '@mebtte/react-media-session';

/**
 * <MediaSession {...props} />
 * or
 * <MediaSession {...props}>
 *   children
 * </MediaSession>
 */
<MediaSession
  title="Way back"
  artist="Vicetone,Cozi Zuehlsdorff"
  album="Way Back"
  artwork={[
    {
      src: 'cover_large.jpeg',
      size: '256x256,384x384,512x512',
      type: 'image/jpeg',
    },
    {
      src: 'cover_small.jpeg',
      size: '96x96,128x128,192x192',
      type: 'image/jpeg',
    },
  ]}
  onPlay={() => audio.play()}
  onPause={() => audio.pause()}
  onSeekBackward={() => (audio.currentTime -= 10)}
  onSeekForward={() => (audio.currentTime += 10)}
  onPreviousTrack={() => playPreviousMusic()}
  onNextTrack={() => playNextMusic()}
/>;

Props

propstyperequireddefault
titlestringfalse''
artiststringfalse''
albumstringfalse''
artworkarray({ src: string, size: string, type?: string })false[]
onPlayfuncfalsenull
onPausefuncfalsenull
onSeekBackwardfuncfalsenull
onSeekForwardfuncfalsenull
onPreviousTrackfuncfalsenull
onNextTrackfuncfalsenull

Example

  • https://mebtte.github.io/react-media-session

    Please use browser that support mediaSession, see it on caniuse.

Question

  • If browser do not support mediaSession, will it throw error?

    if browser do not support mediaSession, it will do nothing.

LICENSE

MIT

Keywords

FAQs

Package last updated on 14 Apr 2020

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