Skip to content

Commit

Permalink
Merge pull request #19 from lovegaoshi/dev-android-auto
Browse files Browse the repository at this point in the history
chore: sync up main
  • Loading branch information
lovegaoshi authored Sep 19, 2023
2 parents 7215788 + 11b5ff8 commit 7411ef5
Show file tree
Hide file tree
Showing 171 changed files with 1,526 additions and 616 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/platform-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Build App
run: |-
cd example/ios
xcodebuild build -workspace example.xcworkspace -scheme example -destination 'platform=iOS Simulator,name=iPhone 12 Pro'
xcodebuild build -workspace RNTPExample.xcworkspace -scheme RNTPExample -destination 'platform=iOS Simulator,name=iPhone 12 Pro'
check-typescript:
runs-on: ubuntu-latest
steps:
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
# [4.0.0-rc08](https://github.com/doublesymmetry/react-native-track-player/compare/v4.0.0-rc07...v4.0.0-rc08) (2023-09-07)

* **RN:** Undeprecate updateNowPlayingMetadata
* **android:** Restore notification image caching
* **RN:** Fix issue with updateOptions and local images
* **ios:** Activate session on play to avoid issues with background audio
* **ios:** Second fix for repeat mode
* **ios:** Correctly update control center progress when pausing/playing

# [4.0.0-rc07](https://github.com/doublesymmetry/react-native-track-player/compare/v4.0.0-rc06...v4.0.0-rc07) (2023-08-11)

* **ios:** Fix firing of `EventType.PlaybackQueueEnded` (fixes #2038)
* **android:** Avoid emitting track changed when replaying the same track
* **android:** Fixed a regression where `reset()` wasn't clearing notification properly
* **android:** Resolved a where the update metadata method was not working

# [4.0.0-rc06](https://github.com/doublesymmetry/react-native-track-player/compare/v4.0.0-rc05...v4.0.0-rc06) (2023-07-25)

* **ios:** Fix iOS not repeating track in RepeatMode.Track
* **RN:** Improve types on asset types
* **android:** Fix foreground issues and notification item
* **ios** Fix race conditions in player property setting
* **android:** Improve notification updates when spamming notification buttons
* **android** Fix AudioPlayerState.IDLE when queue emptied
* **android** Improve metadata handling

# [4.0.0-rc05](https://github.com/doublesymmetry/react-native-track-player/compare/v4.0.0-rc04...v4.0.0-rc05) (2023-06-26)

* **ios:** Fix crash on getting current item
Expand Down
134 changes: 30 additions & 104 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img src="https://react-native-track-player.js.org/img/optimized-logo.svg" width="300" />
<img src="https:/rntp.dev/img/optimized-logo.svg" width="300" />

[![downloads](https://img.shields.io/npm/dw/react-native-track-player.svg)](https://www.npmjs.com/package/react-native-track-player)
[![npm](https://img.shields.io/npm/v/react-native-track-player.svg)](https://www.npmjs.com/package/react-native-track-player)
Expand All @@ -9,14 +9,14 @@

A fully-fledged audio module created for music apps. Provides audio playback, external media controls, background mode and more!

- [Documentation](https://react-native-track-player.js.org)
* [Installation](https://react-native-track-player.js.org/docs/basics/installation/)
* [Getting Started](https://react-native-track-player.js.org/docs/basics/getting-started/)
* [API Docs](https://react-native-track-player.js.org/docs/api/events)
* [Platform Support](https://react-native-track-player.js.org/docs/basics/platform-support)
* [Background Mode](https://react-native-track-player.js.org/docs/basics/background-mode)
* [Build Preferences](https://react-native-track-player.js.org/docs/basics/build-preferences)
* [v2 Migration Guide](https://react-native-track-player.js.org/docs/v2-migration)
- [Documentation](https://rntp.dev)
* [Installation](https://rntp.dev/docs/basics/installation/)
* [Getting Started](https://rntp.dev/docs/basics/getting-started/)
* [API Docs](https://rntp.dev/docs/api/events)
* [Platform Support](https://rntp.dev/docs/basics/platform-support)
* [Background Mode](https://rntp.dev/docs/basics/background-mode)
* [Build Preferences](https://rntp.dev/docs/basics/build-preferences)
* [v2 Migration Guide](https://rntp.dev/docs/v2-migration)
- [Sponsors](#sponsors)
- [Features](#features)
- [Why another music module?](#why-another-music-module)
Expand All @@ -28,96 +28,15 @@ A fully-fledged audio module created for music apps. Provides audio playback, ex

Not sure where to start?

1. Try [Getting Started](https://react-native-track-player.js.org/docs/basics/getting-started).
2. Peruse the [API Docs](https://react-native-track-player.js.org/docs/api/events).
1. Try [Getting Started](https://rntp.dev/docs/basics/getting-started).
2. Peruse the [API Docs](https://rntp.dev/docs/api/events).
3. Run the [Example Project](/example).

## Sponsors
## Commerical Usage

react-native-track-player is made possible by the generosity of the sponsors below, and many other [individual backers](https://react-native-track-player.js.org/docs/sponsors#backers). Sponsoring directly impacts the longevity of this project.
**Are you using RNTP for a personal project?** Great! Sponsor us if you're able but otherwise you can support us by reporting any bugs you find, sending us screenshots of your projects and starring us on Github 🌟

Businesses: support continued development and maintenance via sponsoring contracts:
E-mail: oss @ doublesymmetry dot com

#### 🥇 Gold sponsors (\$2000+ total contributions)

<table>
<tr>
<td align="center">
<a href="http://radio.garden/">
<img src="https://avatars.githubusercontent.com/u/271885?v=4" align="center" width="100" title="Radio Garden" alt="Radio Garden">
<br /><sub><b>Radio Garden</b></sub>
</a>
</td>
</tr>
</table>

#### 🗝 Silver Sponsor (\$500+ per month)

[Become the first silver sponsor!](https://github.com/sponsors/DoubleSymmetry)

#### 🔑 Bronze Sponsor (\$200+ per month)

<table>
<tr>
<td align="center">
<a href="http://www.voxist.com/">
<img src="https://avatars.githubusercontent.com/u/18028734?s=200&v=4" align="center" width="75" title="Voxist" alt="Voxist">
<br /><sub><b>Voxist</b></sub>
</a>
</td>
</tr>
</table>


#### 🥉 Bronze sponsors (\$100+ per month)

<table>
<tr>
<td align="center">
<a href="https://app.momento.fm/">
<img src="https://avatars.githubusercontent.com/u/98929576?s=200&v=4" align="center" width="50" title="Voxist" alt="Voxist">
<br /><sub><b>Momento</b></sub>
</a>
</td>
<td align="center">
<a href="https://stand.fm/">
<img src="https://drive.google.com/uc?id=1PwVUjqiqIQqw18sL_0n9Cx0VQ5zisoUW" align="center" height="50" title="stand.fm" alt="stand.fm">
<br /><sub><b>stand.fm</b></sub>
</a>
</td>
</tr>
</table>

#### ✨ Contributing sponsors (\$25+ per month)

<table>
<tr>
<td align="center">
<img src="https://avatars.githubusercontent.com/u/102089139?s=30&v=4" align="center" width="30" title="Through the Word" alt="Through the Word">
</td>
<td align="center">
<img src="https://avatars.githubusercontent.com/u/11860029?s=30&v=4" align="center" width="30" title="Podverse" alt="Podverse">
</td>
<td align="center">
<img src="https://avatars.githubusercontent.com/u/2523678?s=30&v=4" align="center" width="30" title="Elliot Dickison" alt="Elliot Dickison">
</td>
<td align="center">
<img src="https://avatars.githubusercontent.com/u/1085976?s=30&v=4" align="center" width="30" title="Brad Flood" alt="Brad Flood">
</td>
<td align="center">
<img src="https://avatars.githubusercontent.com/u/271885?s=30&v=4" align="center" width="30" title="puckey" alt="puckey">
</td>
<td align="center">
<img src="https://avatars.githubusercontent.com/u/77853659?s=30&v=4" align="center" width="30" title="Studio 206" alt="Studio 206">
</td>
<td align="center">
<img src="https://avatars.githubusercontent.com/u/42785824?s=30&v=4" align="center" width="30" title="MonokaiJs" alt="MonokaiJs">
</td>
</tr>
</table>

---
**Are you using RNTP at your organisation and/or making money from it?** Awesome! We rely on your support to keep RNTP developed and maintained under the Apache-2.0 license. You can do that through [Github Sponsors](https://github.com/sponsors/doublesymmetry).

## Features

Expand All @@ -143,7 +62,7 @@ All audio modules (like `react-native-sound`) don't play in a separated service

## Example Setup

First please take a look at the [Getting Started](https://react-native-track-player.js.org/docs/basics/getting-started/) guide, but a basic example of how to play a track:
First please take a look at the [Getting Started](https://rntp.dev/docs/basics/getting-started/) guide, but a basic example of how to play a track:

```javascript
import TrackPlayer from 'react-native-track-player';
Expand Down Expand Up @@ -172,8 +91,15 @@ start();
<table>
<tr>
<td align="center"><a href="https://github.com/dcvz"><img src="https://avatars.githubusercontent.com/u/2475932?v=4" width="100px;" alt=""/><br /><sub><b>David Chavez</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/mpivchev"><img src="https://avatars.githubusercontent.com/u/6960329?v=4" width="100px;" alt=""/><br /><sub><b>Milen Pivchev</b></sub></a><br /></td>
</tr>
</table>

## External Core Contributors ✨

<table>
<tr>
<td align="center"><a href="https://github.com/jspizziri"><img src="https://avatars.githubusercontent.com/u/1452066?v=4" width="100px;" alt=""/><br /><sub><b>Jacob Spizziri</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/puckey"><img src="https://avatars.githubusercontent.com/u/271885?v=4" width="100px;" alt=""/><br /><sub><b>Jonathan Puckey</b></sub></a><br /></td>
</tr>
</table>

Expand Down Expand Up @@ -260,16 +186,16 @@ yarn version --major // 2.0.0
This command will:

1. Generate/update the Changelog
1. Bump the package version
1. Tag & pushing the commit
1. Build & publish the package
2. Bump the package version
3. Tag & pushing the commit
4. Build & publish the package


## Community

You can find us as part of the [React Native Track Player](https://discordapp.com/invite/ya2XDCR):

- `# introductions` - Come greet the newest members of this group!
- `# support` - Ask members of the community to trouble shoot issues with your app and make recommendations.
- `# app-anouncements` - Tell the community about the app you made with this project!
- `# releases` - Stay updated about the latest releases and dev efforts on the project.
- `#introduce-yourself` - Come greet the newest members of this group!
- `#troubleshooting-forum` - Ask members of the community to trouble shoot issues with your app and make recommendations.
- `#show-and-tell` - Tell the community about the app you made with this project!
- `#news-and-releases` - Stay updated about the latest releases and dev efforts on the project.
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ repositories {
}

dependencies {
implementation 'com.github.lovegaoshi:KotlinAudio:v2.0.0-aa13'
implementation 'com.github.lovegaoshi:KotlinAudio:v2.0.0-aa19'
// used when building against local maven
// implementation "com.github.doublesymmetry:kotlin-audio:1.2.2"

Expand All @@ -63,7 +63,7 @@ dependencies {
// Make sure we're using androidx
implementation "androidx.core:core-ktx:1.9.0"
implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.1.0"
implementation "androidx.lifecycle:lifecycle-process:2.6.1"
implementation "androidx.lifecycle:lifecycle-process:2.5.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3"
implementation 'androidx.media:media:1.6.0'
}
11 changes: 6 additions & 5 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@

<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<uses-permission
android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />

<application>

<!-- The main service, handles playback, playlists and media buttons -->
<service android:name="com.doublesymmetry.trackplayer.service.MusicService" android:enabled="true" android:exported="true" android:foregroundServiceType="mediaPlayback">
<service
android:name="com.doublesymmetry.trackplayer.service.MusicService"
android:enabled="true"
android:exported="true"
android:foregroundServiceType="mediaPlayback">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>

<meta-data android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc"/>

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.IBinder;
import android.os.PowerManager;
import android.util.Log;

import androidx.annotation.Nullable;
import androidx.media.MediaBrowserServiceCompat;
import com.facebook.infer.annotation.Assertions;
Expand Down Expand Up @@ -45,7 +48,9 @@ public abstract class HeadlessJsMediaService extends MediaBrowserServiceCompat i

private final Set<Integer> mActiveTasks = new CopyOnWriteArraySet<>();
private static @Nullable PowerManager.WakeLock sWakeLock;




@Override
public int onStartCommand(Intent intent, int flags, int startId) {
HeadlessJsTaskConfig taskConfig = getTaskConfig(intent);
Expand Down Expand Up @@ -87,8 +92,19 @@ public static void acquireWakeLockNow(Context context) {
public @Nullable IBinder onBind(Intent intent) {
return super.onBind(intent);
}

/**

@Override
public void onCreate() {
Intent openAppIntent = getPackageManager().getLaunchIntentForPackage(getPackageName());
openAppIntent.setData(Uri.parse("trackplayer://service-created"));
openAppIntent.setAction(Intent.ACTION_VIEW);
openAppIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(openAppIntent);
super.onCreate();

}

/**
* Start a task. This method handles starting a new React instance if required.
*
* <p>Has to be called on the UI thread.
Expand Down
Loading

0 comments on commit 7411ef5

Please sign in to comment.