{"id":28684029,"url":"https://github.com/PhilipSh/ngx-device-permission","last_synced_at":"2025-06-14T03:04:25.128Z","repository":{"id":294946283,"uuid":"988587301","full_name":"PhilipSh/ngx-device-permission","owner":"PhilipSh","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-27T19:02:01.000Z","size":288,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-10T11:12:45.625Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PhilipSh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-05-22T19:13:22.000Z","updated_at":"2025-05-27T19:02:04.000Z","dependencies_parsed_at":"2025-05-29T09:16:14.619Z","dependency_job_id":null,"html_url":"https://github.com/PhilipSh/ngx-device-permission","commit_stats":null,"previous_names":["philipsh/ngx-device-permission"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PhilipSh/ngx-device-permission","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilipSh%2Fngx-device-permission","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilipSh%2Fngx-device-permission/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilipSh%2Fngx-device-permission/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilipSh%2Fngx-device-permission/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhilipSh","download_url":"https://codeload.github.com/PhilipSh/ngx-device-permission/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhilipSh%2Fngx-device-permission/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259752049,"owners_count":22905970,"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":[],"created_at":"2025-06-14T03:01:19.614Z","updated_at":"2025-06-14T03:04:25.122Z","avatar_url":"https://github.com/PhilipSh.png","language":"TypeScript","funding_links":[],"categories":["Underlying Technologies"],"sub_categories":["RxJS"],"readme":"# NgxDevicePermission\n\nAngular library for handling device permissions (camera, microphone, geolocation, etc.) in a reactive way using RxJS.\n\n## Installation\n\n```bash\nnpm install ngx-device-permission\n```\n\n## Usage\n\n### DevicePermissionService\n\nService for working with the Permissions API.\n\n```typescript\nimport { Component, inject } from '@angular/core';\nimport { DevicePermissionService } from 'ngx-device-permission';\n\n@Component({\n  selector: 'app-permissions',\n  standalone: true,\n  template: `\n    \u003cbutton (click)=\"checkPermission()\"\u003eCheck Camera Permission\u003c/button\u003e\n    \u003cbutton (click)=\"observePermission()\"\u003eObserve Microphone Permission\u003c/button\u003e\n  `,\n})\nexport class PermissionsComponent {\n  private devicePermission = inject(DevicePermissionService);\n\n  // Get current permission status\n  checkPermission() {\n    this.devicePermission.getPermissionStatus('camera').subscribe((status) =\u003e {\n      console.log('Camera permission status:', status); // 'granted' | 'denied' | 'prompt'\n    });\n  }\n\n  // Observe permission status changes\n  observePermission() {\n    this.devicePermission\n      .observePermissionChange('microphone')\n      .subscribe((status) =\u003e {\n        console.log('Microphone permission changed:', status);\n      });\n  }\n}\n```\n\n### MediaDeviceService\n\nService for working with media devices (camera, microphone).\n\n```typescript\nimport { Component, inject } from '@angular/core';\nimport { MediaDeviceService } from 'ngx-device-permission';\n\n@Component({\n  selector: 'app-media',\n  standalone: true,\n  template: `\n    \u003cbutton (click)=\"requestMediaAccess()\"\u003eRequest Media Access\u003c/button\u003e\n    \u003cbutton (click)=\"listDevices()\"\u003eList Devices\u003c/button\u003e\n  `,\n})\nexport class MediaComponent {\n  private mediaDevice = inject(MediaDeviceService);\n\n  // Request access to media devices\n  requestMediaAccess() {\n    this.mediaDevice.requestAccess({ video: true, audio: true }).subscribe({\n      next: (stream) =\u003e {\n        console.log('Media access granted:', stream);\n      },\n      error: (error) =\u003e {\n        console.error('Media access denied:', error);\n      },\n    });\n  }\n\n  // Get list of available media devices\n  listDevices() {\n    this.mediaDevice.enumerateDevices().subscribe((devices) =\u003e {\n      console.log('Available devices:', devices);\n    });\n  }\n}\n```\n\n## Supported Permissions\n\nThe library supports all permissions available through the Permissions API:\n\n- camera\n- microphone\n- geolocation\n- notifications\n- push\n- midi\n- clipboard-read\n- clipboard-write\n- payment-handler\n- background-sync\n- persistent-storage\n- ambient-light-sensor\n- accelerometer\n- gyroscope\n- magnetometer\n- screen-wake-lock\n\n## Requirements\n\n- Angular 19.2.0 or higher\n- RxJS 7.8.0 or higher\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPhilipSh%2Fngx-device-permission","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPhilipSh%2Fngx-device-permission","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPhilipSh%2Fngx-device-permission/lists"}