{"id":25603255,"url":"https://github.com/toasterofbread/mediasession-kt","last_synced_at":"2025-11-10T21:33:12.946Z","repository":{"id":232653264,"uuid":"784219766","full_name":"toasterofbread/mediasession-kt","owner":"toasterofbread","description":"A Kotlin Multiplatform library for emitting a system media session","archived":false,"fork":false,"pushed_at":"2024-05-22T20:45:14.000Z","size":125,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-22T21:53:02.948Z","etag":null,"topics":["kotlin","kotlin-multiplatform","kotlin-multiplatform-library","mpris"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toasterofbread.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-09T12:27:50.000Z","updated_at":"2024-05-22T20:44:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"1f94df14-7c79-4b65-8d85-4b974478add1","html_url":"https://github.com/toasterofbread/mediasession-kt","commit_stats":null,"previous_names":["toasterofbread/mediasession-kt"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toasterofbread%2Fmediasession-kt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toasterofbread%2Fmediasession-kt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toasterofbread%2Fmediasession-kt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toasterofbread%2Fmediasession-kt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toasterofbread","download_url":"https://codeload.github.com/toasterofbread/mediasession-kt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240056657,"owners_count":19741178,"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":["kotlin","kotlin-multiplatform","kotlin-multiplatform-library","mpris"],"created_at":"2025-02-21T17:25:48.355Z","updated_at":"2025-11-10T21:33:12.899Z","avatar_url":"https://github.com/toasterofbread.png","language":"Kotlin","readme":"# mediasession-kt\n\nA Kotlin Multiplatform library for emitting a system media session.\n\nWindows implementation adapted from [JavaMediaTransportControls](https://github.com/Selemba1000/JavaMediaTransportControls) by [Selemba1000](https://github.com/Selemba1000).\n\n## Setup\n\nmediasession-kt currently supports the following Kotlin platforms:\n- JVM (tested on x86_64 but may work on other architectures)\n    - Linux\n    - Windows\n- Native\n    - Linux x86_64\n    - Linux ARM64\n    - Windows x86_64\n\n#### Gradle:\n\n1. Add the Maven Central repository to your dependency resolution configuration\n\n```\nrepositories {\n    mavenCentral()\n}\n```\n\n2. Add the following line to your dependencies (replace `\u003cversion\u003e` with the desired mediasession-kt [version](https://github.com/toasterofbread/mediasession-kt/tags))\n\n```\nimplementation(\"dev.toastbits:mediasession:\u003cversion\u003e\")\n```\n\n### Example usage\n\n```\nvar time = TimeSource.Monotonic.markNow()\n\n// Initialise the media session\nval session: MediaSession =\n    MediaSession.create(\n        getPositionMs = { time.elapsedNow().inWholeMilliseconds }\n    )!!\n\n// Set callbacks\nsession.onPlay = {\n    println(\"onPlay called\")\n}\nsession.onSeek = { by_ms: Long -\u003e\n    println(\"onSeek called\")\n}\n\n// Set properties\nsession.setIdentity(\"mediasession.sample\")\nsession.setPlaybackStatus(MediaSessionPlaybackStatus.PAUSED)\nsession.setMetadata(\n    MediaSessionMetadata(\n        title = \"Title\",\n    )\n)\n\n// Enable session (asynchronous)\nsession.setEnabled(true)\n```\n\n#### See the [sample application](sample/src/commonMain/kotlin/dev/toastbits/sample/Sample.kt) for a more detailed example\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoasterofbread%2Fmediasession-kt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoasterofbread%2Fmediasession-kt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoasterofbread%2Fmediasession-kt/lists"}