{"id":15591786,"url":"https://github.com/marshallofsound/electron-media-service","last_synced_at":"2025-06-21T12:39:40.384Z","repository":{"id":48020533,"uuid":"88321075","full_name":"MarshallOfSound/electron-media-service","owner":"MarshallOfSound","description":"OS Media Service integration for Electron apps","archived":false,"fork":false,"pushed_at":"2022-12-06T19:50:07.000Z","size":166,"stargazers_count":37,"open_issues_count":14,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-30T17:51:22.244Z","etag":null,"topics":["electron","media","native-javascript"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarshallOfSound.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-15T03:28:58.000Z","updated_at":"2025-04-28T21:22:16.000Z","dependencies_parsed_at":"2023-01-23T15:00:09.064Z","dependency_job_id":null,"html_url":"https://github.com/MarshallOfSound/electron-media-service","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/MarshallOfSound/electron-media-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshallOfSound%2Felectron-media-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshallOfSound%2Felectron-media-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshallOfSound%2Felectron-media-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshallOfSound%2Felectron-media-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarshallOfSound","download_url":"https://codeload.github.com/MarshallOfSound/electron-media-service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarshallOfSound%2Felectron-media-service/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261126206,"owners_count":23113290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electron","media","native-javascript"],"created_at":"2024-10-02T23:47:39.350Z","updated_at":"2025-06-21T12:39:35.368Z","avatar_url":"https://github.com/MarshallOfSound.png","language":"Objective-C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Electron Media Service\n---------------------------\n\n[![Build Status](https://travis-ci.org/MarshallOfSound/electron-media-service.svg?branch=master)](https://travis-ci.org/MarshallOfSound/electron-media-service)\n[![npm version](https://badge.fury.io/js/electron-media-service.svg)](https://www.npmjs.com/package/electron-media-service)\n[![npm](https://img.shields.io/npm/dt/electron-media-service.svg?maxAge=2592000)](https://www.npmjs.com/package/electron-media-service)\n[![license](https://img.shields.io/github/license/MarshallOfSound/electron-media-service.svg?maxAge=2592000)](https://github.com/GPMDP/electron-devtools-installer/blob/master/LICENSE)\n![status](https://img.shields.io/badge/Status-%20Ready%20for%20Awesome-red.svg)\n\nThis is an easy way to get OS level media integration cross-platform in Electron, it hooks\ninto the following system API's.\n\n| Platform | API | Requirements |\n|----------|-----|--------------|\n| `darwin` | [`MPRemoteCommandCenter`](https://developer.apple.com/reference/mediaplayer/mpremotecommandcenter?language=objc) and [`MPNowPlayingInfoCenter`](https://developer.apple.com/reference/mediaplayer/mpnowplayinginfocenter?language=objc) | macOS 10.12.1+ |\n| `win32` *Coming Soon* | [`MediaTransportControls`](https://msdn.microsoft.com/en-us/library/windows/desktop/dn892355(v=vs.85).aspx) | Windows 10+ |\n| `linux` *Coming Soon* | [`DBus`](https://dbus.freedesktop.org/doc/dbus-specification.html) | Well... DBus :D |\n\nAll you have to do to get all this awesome for you is\n\n```js\nimport MediaService from 'electron-media-service';\n\nconst myService = new MediaService();\n\nmyService.startService();\nmyService.on('play', () =\u003e playSomething());\nmyService.on('pause', () =\u003e pauseSomething());\nmyService.setMetaData({\n  title: 'Never Gonna Give You Up',\n  // Other track meta data here\n});\n```\n\n## What does it look like?\n\n### macOS\n\n![macOS](macOS.png)\n\n## Methods\n\n### `myService.startService()`\n\nStarts the media service my registering the application with the system, no other methods\nor events will work until this method is called.  It's a good idea to give users an option\nto not start the service as it can be annoying for some users especially on Windows 10.\n\n### `myService.stopService()`\n\nAttempts to unregister the service from the system, sometimes a full relaunch is required\nto unregister an application but this method tries it's hardest.\n\n### `myService.isStarted()`\n\nReturns `Boolean`, whether the service is started yet or not.  If you forget whether you\nstarted it or not you can always call this method to check.\n\n### `myService.setMetaData(meta)`\n\n* `meta` Object - The current tracks MetaData\n  * `title` String - The title of the track\n  * `artist` String - The name of the artist\n  * `album` String - The name of the album\n  * `albumArt` String - HTTP url to an image for the album art\n  * `state` String - One of `playing`, `paused` or `stopped`\n  * `id` Number - A unique ID for this track, can be randomly generated as it doesn't really affect anything\n  * `currentTime` Number - Progress through the track in milliseconds\n  * `duration` Number - Total length of the track in milliseconds\n\n## Events\n\n### `myService.on('play')`\n\nFired when the user or the system requests the track to start playing\n\n### `myService.on('pause')`\n\nFired when the user or the system requests the track to pause\n\n### `myService.on('playPause')`\n\nFired when the user or the system requests the track to toggle between playing and paused\n\n### `myService.on('next')`\n\nFired when the user or the system requests the player to skip to the next track\n\n### `myService.on('previous')`\n\nFired when the user or the system requests the player to skip back to the previous track\n\n### `myService.on('seek')`\n\nFired when the user or the system requests the player to seek through the track to the given time.\n\nThe target time will be given in milliseconds as the first argument to the event like so.\n\n```js\nmyService.on('seek', (to) =\u003e {\n  console.log(`We should seek to ${to}ms`)\n})\n```\n\n## What happens on unsupported platforms?\n\nWe automatically give you a noop `MediaService` class, all methods do nothing and\nno events are ever fired.  This allows you to not worry about supported platforms\nand just write code.  Call whatever methods you want and nothing will break.\n\nLicense\n-------\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 Samuel Attard\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarshallofsound%2Felectron-media-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarshallofsound%2Felectron-media-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarshallofsound%2Felectron-media-service/lists"}