Skip to content

wjacker/android-media-watcher

Repository files navigation

android-media-watcher

Android-only Capacitor plugin for MediaSession and playback state monitoring

Platforms

  • ✅ Android
  • ❌ iOS (Not supported)
  • ❌ Web

Install

npm install android-media-watcher
npx cap sync

API

MediaWatcher Capacitor plugin interface.

Android-only plugin used to monitor media playback through system notifications and MediaSession.

hasPermission()

hasPermission() => Promise<{ granted: boolean; }>

Checks whether notification listener permission is enabled for this application.

Returns: Promise<{ granted: boolean; }>


requestPermission()

requestPermission() => Promise<void>

Opens system settings so the user can grant notification listener permission manually.


addListener('mediaEvent', ...)

addListener(eventName: 'mediaEvent', listenerFunc: (event: MediaEvent) => void) => Promise<{ remove: () => void; }>

Registers a listener for media playback state changes.

Param Type Description
eventName 'mediaEvent' Event name ("mediaEvent")
listenerFunc (event: MediaEvent) => void Callback invoked when media state changes

Returns: Promise<{ remove: () => void; }>


Interfaces

MediaEvent

Prop Type
title string
artist string
album string
playbackState string
packageName string

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors