https://github.com/chaimpaneth/react-native-android-media-browser
Helper for setting MediaBrowserServiceCompat for android-auto, automative and wearables
https://github.com/chaimpaneth/react-native-android-media-browser
Last synced: 9 months ago
JSON representation
Helper for setting MediaBrowserServiceCompat for android-auto, automative and wearables
- Host: GitHub
- URL: https://github.com/chaimpaneth/react-native-android-media-browser
- Owner: chaimPaneth
- License: mit
- Created: 2023-04-25T09:21:03.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-09-05T08:14:35.000Z (10 months ago)
- Last Synced: 2025-09-05T09:18:20.889Z (10 months ago)
- Language: Java
- Size: 250 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-android-media-browser
A React Native module that provides a Media Browser Service for Android, allowing you to create a custom media browsing experience for Android Auto and Android Automotive OS.
## Installation
1. Install the library using npm or yarn: `npm install react-native-android-media-browser` or `yarn add react-native-android-media-browser`.
2. Link the native module using `react-native link` (if you're using a version of React Native <= 0.59): `react-native link react-native-android-media-browser`.
## Usage
1. Import the `MediaBrowser` module in your JavaScript code:
```javascript
import MediaBrowser, {
CONTENT_STYLE_LIST_ITEM,
CONTENT_STYLE_GRID_ITEM,
CONTENT_STYLE_CATEGORY_LIST_ITEM,
CONTENT_STYLE_CATEGORY_GRID_ITEM
} from 'react-native-android-media-browser';
```
2. Define your media items hierarchy:
```javascript
const mediaItems = [
{
id: "ROOT",
children: [
{
id: "Home",
title: "Home",
subTitle: "Welcome home!",
icon: "home.png",
browsableStyle: CONTENT_STYLE_GRID_ITEM,
playableStyle: CONTENT_STYLE_LIST_ITEM,
playableOrBrowsable: "BROWSABLE",
children: [
// ... more nested media items
],
},
// ... other top-level media items
],
},
];
```
3. Set the media items hierarchy in the MediaBrowser module:
```javascript
MediaBrowser.setMediaItems(mediaItems);
```
4. You can also add, delete, and update media items:
```javascript
MediaBrowser.addMediaItem(item);
MediaBrowser.deleteMediaItem(itemId);
MediaBrowser.updateMediaItem(item);
```
## License
MIT