Skip to content

Commit

Permalink
fix backPress method Android
Browse files Browse the repository at this point in the history
  • Loading branch information
jepiqueau committed Jan 24, 2023
1 parent 10427f1 commit c7d6f18
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 9 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 4.6.2-1 (2023-01-24)

### Chores

- Update to Capacitor 4.6.2

### Bug Fixes

- PR Android: Check pipEnabled in backPressed function by j-oppenhuis

## 4.6.1 (2023-01-22)

### Chores
Expand Down
Binary file modified android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified android/build/outputs/aar/android-debug.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public class FullscreenExoPlayerFragment extends Fragment {
private int mCurrentPosition;
private int mDuration;
private static final int videoStep = 10000;
private boolean isCastSession = false;

// Tag for the instance state bundle.
private static final String PLAYBACK_TIME = "play_time";
Expand Down Expand Up @@ -254,6 +255,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
new SessionAvailabilityListener() {
@Override
public void onCastSessionAvailable() {
isCastSession = true;
final Long videoPosition = player.getCurrentPosition();
if (pipEnabled) {
pipBtn.setVisibility(View.GONE);
Expand All @@ -269,6 +271,7 @@ public void onCastSessionAvailable() {

@Override
public void onCastSessionUnavailable() {
isCastSession = false;
final Long videoPosition = castPlayer.getCurrentPosition();
if (pipEnabled) {
pipBtn.setVisibility(View.VISIBLE);
Expand Down Expand Up @@ -352,7 +355,7 @@ public void onPlayerStateChanged(boolean playWhenReady, int state) {
switch (state) {
case ExoPlayer.STATE_IDLE:
stateString = "ExoPlayer.STATE_IDLE -";
Toast.makeText(context, "Intenta con otra fuente por favor", Toast.LENGTH_SHORT).show();
Toast.makeText(context, "Video Url not found", Toast.LENGTH_SHORT).show();
playerExit();
break;
case ExoPlayer.STATE_BUFFERING:
Expand Down Expand Up @@ -556,7 +559,21 @@ protected void onPostExecute(Bitmap result) {
* Perform backPressed Action
*/
private void backPressed() {
playerExit();
if (isCastSession) {
playerExit();
}
if (
!isInPictureInPictureMode &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE) &&
isPIPModeeEnabled &&
pipEnabled
) {
pictureInPictureMode();
} else {
playerExit();
}

}

private void resizePressed() {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
"prepublishOnly": "npm run build && npm run docgen"
},
"devDependencies": {
"@capacitor/android": "^4.6.1",
"@capacitor/core": "^4.6.1",
"@capacitor/android": "^4.6.2",
"@capacitor/core": "^4.6.2",
"@capacitor/docgen": "^0.0.17",
"@capacitor/ios": "^4.6.1",
"@capacitor/ios": "^4.6.2",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^1.0.1",
"@ionic/swiftlint-config": "^1.1.2",
Expand Down
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<a href="https://www.npmjs.com/package/capacitor-video-player"><img src="https://img.shields.io/npm/dw/capacitor-video-player?style=flat-square" /></a>
<a href="https://www.npmjs.com/package/capacitor-video-player"><img src="https://img.shields.io/npm/v/capacitor-video-player?style=flat-square" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-6-orange?style=flat-square" /></a>
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-7-orange?style=flat-square" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->
</p>

Expand Down Expand Up @@ -268,6 +268,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="https://github.com/KANekT"><img src="https://avatars.githubusercontent.com/u/580273?v=4" width="100px;" alt=""/><br /><sub><b>Пронин Андрей KANekT</b></sub></a><br /><a href="https://github.com/jepiqueau/capacitor-video-player/commits?author=KANekT" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/mueslirieger"><img src="https://avatars.githubusercontent.com/u/20973893?v=4" width="100px;" alt=""/><br /><sub><b>Michael Rieger</b></sub></a><br /><a href="https://github.com/jepiqueau/capacitor-video-player/commits?author=mueslirieger" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/PhantomPainX"><img src="https://avatars.githubusercontent.com/u/47803967?v=4" width="100px;" alt=""/><br /><sub><b>Manuel García Marín</b></sub></a><br /><a href="https://github.com/jepiqueau/capacitor-video-player/commits?author=PhantomPainX" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/j-oppenhuis"><img src="https://avatars.githubusercontent.com/u/46529655?v=4" width="100px;" alt=""/><br /><sub><b>Jelle Oppenhuis</b></sub></a><br /><a href="https://github.com/jepiqueau/capacitor-video-player/commits?author=j-oppenhuis" title="Code">💻</a></td>
</tr>
</table>
Expand Down

0 comments on commit c7d6f18

Please sign in to comment.