Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v1.7.1 #314

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [7.1.1] - 26-04-23

### Fixed

- Fixed an issue where the selectedAudioTrack and selectedVideoTrack were not is sync with the ctual selected mediatracks on the native player.

## [7.1.0] - 24-04-23

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private const val PROP_LABEL = "label"
private const val PROP_TYPE = "type"
private const val PROP_CODECS = "codecs"
private const val PROP_NAME = "name"
private const val PROP_ENABLED = "enabled"
private const val PROP_SRC = "src"
private const val PROP_FORCED = "forced"
private const val PROP_AUDIO_SAMPLING_RATE = "audioSamplingRate"
Expand Down Expand Up @@ -165,6 +166,7 @@ object TrackListAdapter {
audioTrackPayload.putString(PROP_KIND, audioTrack.kind)
audioTrackPayload.putString(PROP_LABEL, audioTrack.label)
audioTrackPayload.putString(PROP_LANGUAGE, audioTrack.language)
audioTrackPayload.putBoolean(PROP_ENABLED, audioTrack.isEnabled)
val qualityList = audioTrack.qualities
val qualities = Arguments.createArray()
try {
Expand Down Expand Up @@ -209,6 +211,7 @@ object TrackListAdapter {
videoTrackPayload.putString(PROP_KIND, videoTrack.kind)
videoTrackPayload.putString(PROP_LABEL, videoTrack.label)
videoTrackPayload.putString(PROP_LANGUAGE, videoTrack.language)
videoTrackPayload.putBoolean(PROP_ENABLED, videoTrack.isEnabled)
val qualities = Arguments.createArray()
try {
val qualityList = videoTrack.qualities
Expand Down
13 changes: 6 additions & 7 deletions doc/audio-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@ the player will regain audio focus afterward and play-out while resume.
### Audio "ducking"

When another app seeks audio focus, it can optionally indicate that the current audio focus holder can
lower its playback volume to continue playing (AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK). The new focus holder does
lower its playback volume to continue playing (`AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK`). The new focus holder does
not require other apps to be silent. This behavior is known as "ducking."

However, `react-native-theoplayer` does not perform audio "ducking"; it consistently pauses playback.

In summary:

| Event | Action |
|--------------------------------------------------|-----------------|
| `AUDIOFOCUS_LOSS`, `AUDIOFOCUS_LOSS_TRANSIENT`, `AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK` | Pause play-out |
| `AUDIOFOCUS_GAIN` | Resume play-out |
| Event | Action |
|------------------------------------------------|-----------------------------------|
| `AUDIOFOCUS_LOSS`, `AUDIOFOCUS_LOSS_TRANSIENT` | Pause play-out |
| `AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK` | Lower volume |
| `AUDIOFOCUS_GAIN` | Resume play-out or restore volume |


## Audio Becoming Noisy
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"scripts": {
"android": "npx react-native run-android",
"android-release": "npx react-native run-android --variant release",
"android-release": "npx react-native run-android --mode release",
"ios": "npx react-native run-ios",
"web": "webpack-dev-server --config ./web/webpack.config.js --mode development",
"web-release": "webpack --config ./web/webpack.config.js --mode production",
Expand Down
3 changes: 3 additions & 0 deletions ios/THEOplayerRCTTrackMetadataAggregator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let PROP_KIND: String = "kind"
let PROP_LANGUAGE: String = "language"
let PROP_MODE: String = "mode"
let PROP_LABEL: String = "label"
let PROP_ENABLED: String = "enabled"
let PROP_TYPE: String = "type"
let PROP_QUALITIES: String = "qualities"
let PROP_ACTIVE_QUALITY: String = "activeQuality"
Expand Down Expand Up @@ -183,6 +184,7 @@ class THEOplayerRCTTrackMetadataAggregator {
entry[PROP_KIND] = audioTrack.kind
entry[PROP_LANGUAGE] = audioTrack.language
entry[PROP_LABEL] = audioTrack.label
entry[PROP_ENABLED] = audioTrack.enabled
entry[PROP_QUALITIES] = [] // empty: qualities are not being exposed on iOS
//entry[PROP_ACTIVE_QUALITY] = // undefined: qualities are not being exposed on iOS
//entry[PROP_TARGET_QUALITY] = // undefined: qualities are not being exposed on iOS
Expand Down Expand Up @@ -223,6 +225,7 @@ class THEOplayerRCTTrackMetadataAggregator {
entry[PROP_KIND] = videoTrack.kind
entry[PROP_LANGUAGE] = videoTrack.language
entry[PROP_LABEL] = videoTrack.label
entry[PROP_ENABLED] = videoTrack.enabled
entry[PROP_QUALITIES] = [] // empty: qualities are not being exposed on iOS
//entry[PROP_ACTIVE_QUALITY] = // undefined: qualities are not being exposed on iOS
//entry[PROP_TARGET_QUALITY] = // undefined: qualities are not being exposed on iOS
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-theoplayer",
"version": "7.1.0",
"version": "7.1.1",
"description": "A THEOplayer video component for react-native.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
5 changes: 5 additions & 0 deletions src/api/track/MediaTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export interface MediaTrack extends Track {
* The qualities of the media track.
*/
readonly qualities: Quality[];

/**
* Marks the track to be the selected track for playout
*/
readonly enabled: boolean;
}

export function findMediaTrackByUid(mediaTracks: MediaTrack[], uid: number | undefined): MediaTrack | undefined {
Expand Down
6 changes: 6 additions & 0 deletions src/internal/adapter/THEOplayerAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,15 @@ export class THEOplayerAdapter extends DefaultEventDispatcher<PlayerEventMap> im
if (isAudio) {
this._state.audioTracks = removeTrack(this._state.audioTracks, track);
this._state.audioTracks = addTrack(this._state.audioTracks, track);
if (track.enabled) {
this._state.selectedAudioTrack = track.uid;
}
} else {
this._state.videoTracks = removeTrack(this._state.videoTracks, track);
this._state.videoTracks = addTrack(this._state.videoTracks, track);
if (track.enabled) {
this._state.selectedVideoTrack = track.uid;
}
}
break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/internal/adapter/web/TrackUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function fromNativeMediaTrackList(tracks: NativeMediaTrackList): MediaTra
}

export function fromNativeMediaTrack(track: NativeMediaTrack): MediaTrack {
const { id, uid, kind, label, language, activeQuality, qualities } = track;
const { id, uid, kind, label, language, activeQuality, qualities, enabled } = track;
return {
kind,
label,
Expand All @@ -71,6 +71,7 @@ export function fromNativeMediaTrack(track: NativeMediaTrack): MediaTrack {
uid,
activeQuality,
qualities,
enabled,
} as MediaTrack;
}

Expand Down
Loading