@nativescript/canvas-media 2.0.25 → 2.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/audio/common.d.ts +1 -0
- package/audio/common.js +20 -8
- package/audio/common.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/canvas_media.aar +0 -0
- package/platforms/android/java/org/nativescript/canvas/media/AudioContextTapProcessor.java +31 -21
- package/platforms/android/java/org/nativescript/canvas/media/AudioHelper.java +307 -104
- package/video/common.d.ts +1 -0
- package/video/common.js +21 -6
- package/video/common.js.map +1 -1
package/audio/common.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare abstract class AudioBase extends MediaBase {
|
|
|
26
26
|
_listeners: Record<string, Function[]>;
|
|
27
27
|
addEventListener(type: string, listener: Function, useCapture?: boolean | any): void;
|
|
28
28
|
removeEventListener(type: string, listener: Function, useCapture?: boolean | any): void;
|
|
29
|
+
private _invokeListener;
|
|
29
30
|
_notifyListener(type: string): void;
|
|
30
31
|
_removeListener(type: string, listener: Function, listenersObj: any): void;
|
|
31
32
|
_listenerExist(type: string, listener: Function, listenersObj: any): boolean;
|
package/audio/common.js
CHANGED
|
@@ -6,6 +6,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { CSSType } from '@nativescript/core';
|
|
8
8
|
import { MediaBase } from '../common';
|
|
9
|
+
function warnAudioListener(label, _error) {
|
|
10
|
+
try {
|
|
11
|
+
console.warn(label);
|
|
12
|
+
}
|
|
13
|
+
catch { }
|
|
14
|
+
}
|
|
9
15
|
let AudioBase = class AudioBase extends MediaBase {
|
|
10
16
|
constructor() {
|
|
11
17
|
super(...arguments);
|
|
@@ -39,27 +45,33 @@ let AudioBase = class AudioBase extends MediaBase {
|
|
|
39
45
|
const target = isCapture ? this._capturedListeners : this._listeners;
|
|
40
46
|
this._removeListener(type, listener, target);
|
|
41
47
|
}
|
|
48
|
+
_invokeListener(type, listener, source) {
|
|
49
|
+
try {
|
|
50
|
+
listener.call(this);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
warnAudioListener(`Audio.${type} ${source} listener failed`, error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
42
56
|
_notifyListener(type) {
|
|
43
57
|
const captured = this._capturedListeners?.[type];
|
|
44
58
|
if (Array.isArray(captured)) {
|
|
45
59
|
for (let i = 0; i < captured.length; i++) {
|
|
46
60
|
const cb = captured[i];
|
|
47
61
|
if (typeof cb === 'function')
|
|
48
|
-
cb
|
|
62
|
+
this._invokeListener(type, cb, 'captured');
|
|
49
63
|
}
|
|
50
64
|
}
|
|
65
|
+
const handler = this[`on${type}`];
|
|
66
|
+
if (typeof handler === 'function') {
|
|
67
|
+
this._invokeListener(type, handler, 'property');
|
|
68
|
+
}
|
|
51
69
|
const events = this._listeners?.[type];
|
|
52
70
|
if (Array.isArray(events)) {
|
|
53
71
|
for (let i = 0; i < events.length; i++) {
|
|
54
72
|
const cb = events[i];
|
|
55
|
-
if (typeof this[type] === 'function') {
|
|
56
|
-
try {
|
|
57
|
-
this[type]();
|
|
58
|
-
}
|
|
59
|
-
catch (e) { }
|
|
60
|
-
}
|
|
61
73
|
if (typeof cb === 'function')
|
|
62
|
-
cb
|
|
74
|
+
this._invokeListener(type, cb, 'registered');
|
|
63
75
|
}
|
|
64
76
|
}
|
|
65
77
|
}
|
package/audio/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../packages/canvas-media/audio/common.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../packages/canvas-media/audio/common.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,o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,CAAa;AACzB,mBAAS,GAAG,MAAM,AAAT,CAAU;AACnB,oBAAU,GAAG,OAAO,AAAV,CAAW;AACrB,sBAAY,GAAG,SAAS,AAAZ,CAAa;AACzB,6BAAmB,GAAG,gBAAgB,AAAnB,CAAoB;AACvC,yBAAe,GAAG,YAAY,AAAf,CAAgB;AAC/B,6BAAmB,GAAG,gBAAgB,AAAnB,CAAoB;AACvC,6BAAmB,GAAG,gBAAgB,AAAnB,CAAoB;AACvC,yBAAe,GAAG,YAAY,AAAf,CAAgB;AAC/B,oBAAU,GAAG,OAAO,AAAV,CAAW;AACrB,oBAAU,GAAG,OAAO,AAAV,CAAW;AAEZ,sBAAY,GAAG,CAAC,AAAJ,CAAK;AACjB,uBAAa,GAAG,CAAC,AAAJ,CAAK;AAClB,2BAAiB,GAAG,CAAC,AAAJ,CAAK;AACtB,0BAAgB,GAAG,CAAC,AAAJ,CAAK;AACrB,0BAAgB,GAAG,CAAC,AAAJ,CAAK;AArBvB,SAAS;IAD9B,OAAO,CAAC,OAAO,CAAC;GACK,SAAS,CAmG9B"}
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -7,6 +7,7 @@ import androidx.media3.common.util.UnstableApi;
|
|
|
7
7
|
import java.nio.ByteBuffer;
|
|
8
8
|
import java.nio.ByteOrder;
|
|
9
9
|
import java.nio.FloatBuffer;
|
|
10
|
+
import java.util.Arrays;
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
@UnstableApi
|
|
@@ -33,6 +34,9 @@ public class AudioContextTapProcessor extends BaseAudioProcessor {
|
|
|
33
34
|
|
|
34
35
|
@Override
|
|
35
36
|
public AudioFormat onConfigure(AudioFormat inputFormat) throws UnhandledAudioFormatException {
|
|
37
|
+
if (bytesPerSample(inputFormat.encoding) <= 0) {
|
|
38
|
+
throw new UnhandledAudioFormatException(inputFormat);
|
|
39
|
+
}
|
|
36
40
|
return inputFormat;
|
|
37
41
|
}
|
|
38
42
|
|
|
@@ -47,32 +51,38 @@ public class AudioContextTapProcessor extends BaseAudioProcessor {
|
|
|
47
51
|
int channels = fmt.channelCount;
|
|
48
52
|
int sampleRate = fmt.sampleRate;
|
|
49
53
|
int bytesPerSample = bytesPerSample(fmt.encoding);
|
|
54
|
+
int sampleCount = bytesPerSample > 0 ? remaining / bytesPerSample : 0;
|
|
55
|
+
int bytesToCopy = sampleCount * bytesPerSample;
|
|
56
|
+
int srcStart = inputBuffer.position();
|
|
57
|
+
|
|
58
|
+
if (sink != null && sink.isActive() && sampleCount > 0 && channels > 0 && sampleRate > 0) {
|
|
59
|
+
if (_floatScratch.length < sampleCount) {
|
|
60
|
+
_floatScratch = new float[Math.max(sampleCount, _floatScratch.length * 2)];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
ByteBuffer src = inputBuffer.duplicate();
|
|
64
|
+
src.order(byteOrderForEncoding(fmt.encoding));
|
|
65
|
+
src.position(srcStart);
|
|
66
|
+
src.limit(srcStart + bytesToCopy);
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
copyToFloat(src, _floatScratch, sampleCount, fmt.encoding);
|
|
70
|
+
sink.onPcmFrames(_floatScratch, sampleCount, sampleRate, channels);
|
|
71
|
+
} catch (Throwable t) {
|
|
72
|
+
android.util.Log.w("AudioContextTapProc", "sink threw", t);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
50
75
|
|
|
51
76
|
ByteBuffer out = replaceOutputBuffer(remaining);
|
|
52
|
-
int srcStart = inputBuffer.position();
|
|
53
77
|
out.put(inputBuffer);
|
|
54
78
|
out.flip();
|
|
79
|
+
}
|
|
55
80
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (_floatScratch.length < sampleCount) {
|
|
60
|
-
_floatScratch = new float[Math.max(sampleCount, _floatScratch.length * 2)];
|
|
61
|
-
}
|
|
62
|
-
ByteBuffer src = inputBuffer.duplicate();
|
|
63
|
-
src.order(ByteOrder.nativeOrder());
|
|
64
|
-
src.position(srcStart);
|
|
65
|
-
src.limit(srcStart + remaining);
|
|
66
|
-
copyToFloat(src, _floatScratch, sampleCount, fmt.encoding);
|
|
67
|
-
try {
|
|
68
|
-
sink.onPcmFrames(_floatScratch, sampleCount, sampleRate, channels);
|
|
69
|
-
} catch (Throwable t) {
|
|
70
|
-
android.util.Log.w("AudioContextTapProc", "sink threw", t);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
81
|
+
private static ByteOrder byteOrderForEncoding(int encoding) {
|
|
82
|
+
if (encoding == ENCODING_PCM_16BIT_BIG_ENDIAN) {
|
|
83
|
+
return ByteOrder.BIG_ENDIAN;
|
|
73
84
|
}
|
|
74
|
-
|
|
75
|
-
inputBuffer.position(srcStart + remaining);
|
|
85
|
+
return ByteOrder.LITTLE_ENDIAN;
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
private static int bytesPerSample(int encoding) {
|
|
@@ -132,7 +142,7 @@ public class AudioContextTapProcessor extends BaseAudioProcessor {
|
|
|
132
142
|
break;
|
|
133
143
|
}
|
|
134
144
|
default: {
|
|
135
|
-
|
|
145
|
+
Arrays.fill(dst, 0, sampleCount, 0f);
|
|
136
146
|
break;
|
|
137
147
|
}
|
|
138
148
|
}
|
|
@@ -12,14 +12,28 @@ import java.io.File;
|
|
|
12
12
|
import java.util.Collections;
|
|
13
13
|
import java.util.Timer;
|
|
14
14
|
import java.util.TimerTask;
|
|
15
|
+
import java.util.List;
|
|
15
16
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
16
|
-
|
|
17
|
+
import androidx.annotation.Nullable;
|
|
18
|
+
import androidx.media3.common.AudioAttributes;
|
|
19
|
+
import androidx.media3.common.DeviceInfo;
|
|
17
20
|
import androidx.media3.common.MediaItem;
|
|
21
|
+
import androidx.media3.common.MediaMetadata;
|
|
22
|
+
import androidx.media3.common.Metadata;
|
|
18
23
|
import androidx.media3.common.PlaybackException;
|
|
19
|
-
import androidx.media3.common.
|
|
24
|
+
import androidx.media3.common.PlaybackParameters;
|
|
20
25
|
import androidx.media3.common.Player;
|
|
26
|
+
import androidx.media3.common.Timeline;
|
|
27
|
+
import androidx.media3.common.TrackSelectionParameters;
|
|
28
|
+
import androidx.media3.common.Tracks;
|
|
29
|
+
import androidx.media3.common.VideoSize;
|
|
30
|
+
import androidx.media3.common.text.Cue;
|
|
31
|
+
import androidx.media3.common.text.CueGroup;
|
|
21
32
|
import androidx.media3.common.util.UnstableApi;
|
|
22
33
|
import androidx.media3.common.util.Util;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
23
37
|
import androidx.media3.datasource.DefaultDataSource;
|
|
24
38
|
import androidx.media3.datasource.DefaultHttpDataSource;
|
|
25
39
|
import androidx.media3.datasource.cache.CacheDataSource;
|
|
@@ -63,35 +77,32 @@ public class AudioHelper implements Player.Listener {
|
|
|
63
77
|
private volatile int _tapNodeChannels;
|
|
64
78
|
private volatile Method _tapNodePushFrames;
|
|
65
79
|
private volatile Method _tapNodeEndStream;
|
|
80
|
+
private volatile Method _tapNodeConfigureFormat;
|
|
66
81
|
private volatile Method _ctxCreateExternalPcm;
|
|
82
|
+
private volatile boolean _tapSuppressesDirectOutput = false;
|
|
83
|
+
private volatile boolean _muted = false;
|
|
84
|
+
private static final int MAX_TAP_REFLECTION_FAILURES = 8;
|
|
85
|
+
private final Object _tapStateLock = new Object();
|
|
86
|
+
private volatile int _tapReflectionFailures = 0;
|
|
67
87
|
|
|
68
88
|
private final AudioContextTapProcessor.Sink _tapSink = new AudioContextTapProcessor.Sink() {
|
|
69
89
|
@Override
|
|
70
90
|
public void onPcmFrames(float[] interleaved, int sampleCount, int sampleRate, int channels) {
|
|
71
91
|
Object node = _tapSourceNode;
|
|
72
|
-
|
|
92
|
+
Method push = _tapNodePushFrames;
|
|
93
|
+
if (node == null || push == null || sampleCount == 0 || sampleRate <= 0 || channels <= 0) return;
|
|
73
94
|
|
|
74
95
|
if (_tapNodeSampleRate != sampleRate || _tapNodeChannels != channels) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Method end = _tapNodeEndStream;
|
|
78
|
-
if (ctx == null || create == null) return;
|
|
79
|
-
Object replacement;
|
|
96
|
+
Method configure = _tapNodeConfigureFormat;
|
|
97
|
+
if (configure == null) return;
|
|
80
98
|
try {
|
|
81
|
-
|
|
99
|
+
configure.invoke(node, sampleRate, channels);
|
|
100
|
+
_tapNodeSampleRate = sampleRate;
|
|
101
|
+
_tapNodeChannels = channels;
|
|
82
102
|
} catch (Throwable t) {
|
|
83
|
-
|
|
103
|
+
handleTapReflectionFailure("configureFormat reflection failed", t);
|
|
84
104
|
return;
|
|
85
105
|
}
|
|
86
|
-
if (replacement == null) return;
|
|
87
|
-
Object old = _tapSourceNode;
|
|
88
|
-
if (old != null && end != null) {
|
|
89
|
-
try { end.invoke(old); } catch (Throwable ignored) {}
|
|
90
|
-
}
|
|
91
|
-
_tapSourceNode = replacement;
|
|
92
|
-
_tapNodeSampleRate = sampleRate;
|
|
93
|
-
_tapNodeChannels = channels;
|
|
94
|
-
node = replacement;
|
|
95
106
|
}
|
|
96
107
|
|
|
97
108
|
float[] payload = interleaved;
|
|
@@ -100,9 +111,10 @@ public class AudioHelper implements Player.Listener {
|
|
|
100
111
|
System.arraycopy(interleaved, 0, payload, 0, sampleCount);
|
|
101
112
|
}
|
|
102
113
|
try {
|
|
103
|
-
|
|
114
|
+
push.invoke(node, (Object) payload);
|
|
115
|
+
_tapReflectionFailures = 0;
|
|
104
116
|
} catch (Throwable t) {
|
|
105
|
-
|
|
117
|
+
handleTapReflectionFailure("pushFrames reflection failed", t);
|
|
106
118
|
}
|
|
107
119
|
}
|
|
108
120
|
|
|
@@ -112,6 +124,15 @@ public class AudioHelper implements Player.Listener {
|
|
|
112
124
|
}
|
|
113
125
|
};
|
|
114
126
|
|
|
127
|
+
private void handleTapReflectionFailure(String label, Throwable t) {
|
|
128
|
+
int failures = ++_tapReflectionFailures;
|
|
129
|
+
android.util.Log.w("AudioHelper", label, t);
|
|
130
|
+
if (failures >= MAX_TAP_REFLECTION_FAILURES) {
|
|
131
|
+
android.util.Log.w("AudioHelper", "disabling audio context tap after repeated failures");
|
|
132
|
+
detachAudioContextTap();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
115
136
|
public interface Callback {
|
|
116
137
|
void onDurationChange(long duration);
|
|
117
138
|
void onPlaying();
|
|
@@ -128,6 +149,40 @@ public class AudioHelper implements Player.Listener {
|
|
|
128
149
|
|
|
129
150
|
Handler handler;
|
|
130
151
|
|
|
152
|
+
private void safeInvoke(String label, Runnable action) {
|
|
153
|
+
try {
|
|
154
|
+
action.run();
|
|
155
|
+
} catch (Throwable t) {
|
|
156
|
+
android.util.Log.w("AudioHelper", label + " failed", t);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private void dispatchOnHandler(String label, Runnable action) {
|
|
161
|
+
Handler currentHandler = handler;
|
|
162
|
+
if (currentHandler == null) {
|
|
163
|
+
safeInvoke(label, action);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
Looper targetLooper = currentHandler.getLooper();
|
|
168
|
+
if (targetLooper != null && targetLooper == Looper.myLooper()) {
|
|
169
|
+
safeInvoke(label, action);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
currentHandler.post(() -> safeInvoke(label, action));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private void updateEffectivePlayerVolume() {
|
|
177
|
+
try {
|
|
178
|
+
if (_player != null) {
|
|
179
|
+
_player.setVolume((_muted || _tapSuppressesDirectOutput) ? 0f : 1f);
|
|
180
|
+
}
|
|
181
|
+
} catch (Throwable t) {
|
|
182
|
+
android.util.Log.w("AudioHelper", "updateEffectivePlayerVolume failed", t);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
131
186
|
public AudioHelper(Context context, String cacheRoot) {
|
|
132
187
|
File cacheDir = new File(cacheRoot, "MEDIA_PLAYER_CACHE");
|
|
133
188
|
if (!cacheDir.exists()) { cacheDir.mkdirs(); }
|
|
@@ -179,6 +234,7 @@ public class AudioHelper implements Player.Listener {
|
|
|
179
234
|
_player = builder.build();
|
|
180
235
|
_player.addListener(this);
|
|
181
236
|
_player.setAudioAttributes(AudioAttributes.DEFAULT, true);
|
|
237
|
+
updateEffectivePlayerVolume();
|
|
182
238
|
|
|
183
239
|
_container = new LinearLayout(context);
|
|
184
240
|
_container.setOrientation(LinearLayout.VERTICAL);
|
|
@@ -200,95 +256,224 @@ public class AudioHelper implements Player.Listener {
|
|
|
200
256
|
@Override
|
|
201
257
|
public void onIsPlayingChanged(boolean isPlaying) {
|
|
202
258
|
long duration = this._player.getDuration();
|
|
203
|
-
|
|
204
|
-
this._callback.onDurationChange(duration);
|
|
205
|
-
}
|
|
206
|
-
this._playing = isPlaying;
|
|
207
|
-
if (isPlaying) {
|
|
259
|
+
dispatchOnHandler("onIsPlayingChanged", () -> {
|
|
208
260
|
if (this._callback != null) {
|
|
209
|
-
this._callback.
|
|
210
|
-
this._callback.onLoadedData();
|
|
211
|
-
}
|
|
212
|
-
if (this._audioView != null) {
|
|
213
|
-
this._audioView.setPlaying(true);
|
|
214
|
-
this._audioView.setDuration(duration);
|
|
261
|
+
safeInvoke("onDurationChange callback", () -> this._callback.onDurationChange(duration));
|
|
215
262
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
AudioHelper that = this;
|
|
222
|
-
_timer.schedule(new TimerTask() {
|
|
223
|
-
@Override
|
|
224
|
-
public void run() {
|
|
225
|
-
handler.post(() -> {
|
|
226
|
-
long current = _player.getCurrentPosition();
|
|
227
|
-
if (that._callback != null) {
|
|
228
|
-
that._callback.onCurrentTimeChanged(current);
|
|
229
|
-
}
|
|
230
|
-
if (that._audioView != null) {
|
|
231
|
-
that._audioView.setCurrentTime(current);
|
|
232
|
-
}
|
|
233
|
-
});
|
|
263
|
+
this._playing = isPlaying;
|
|
264
|
+
if (isPlaying) {
|
|
265
|
+
if (this._callback != null) {
|
|
266
|
+
safeInvoke("onPlaying callback", () -> this._callback.onPlaying());
|
|
267
|
+
safeInvoke("onLoadedData callback", () -> this._callback.onLoadedData());
|
|
234
268
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
_timer
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
269
|
+
if (this._audioView != null) {
|
|
270
|
+
this._audioView.setPlaying(true);
|
|
271
|
+
this._audioView.setDuration(duration);
|
|
272
|
+
}
|
|
273
|
+
if (_timer != null) {
|
|
274
|
+
_timer.cancel();
|
|
275
|
+
_timer = null;
|
|
276
|
+
}
|
|
277
|
+
_timer = new Timer();
|
|
278
|
+
AudioHelper that = this;
|
|
279
|
+
_timer.schedule(new TimerTask() {
|
|
280
|
+
@Override
|
|
281
|
+
public void run() {
|
|
282
|
+
dispatchOnHandler("onCurrentTimeChanged", () -> {
|
|
283
|
+
long current = _player.getCurrentPosition();
|
|
284
|
+
if (that._callback != null) {
|
|
285
|
+
safeInvoke("onCurrentTimeChanged callback", () -> that._callback.onCurrentTimeChanged(current));
|
|
286
|
+
}
|
|
287
|
+
if (that._audioView != null) {
|
|
288
|
+
that._audioView.setCurrentTime(current);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}, 0, 1000);
|
|
293
|
+
} else {
|
|
294
|
+
if (_timer != null) {
|
|
295
|
+
_timer.cancel();
|
|
296
|
+
_timer = null;
|
|
297
|
+
}
|
|
298
|
+
long currentTime = this._player.getCurrentPosition();
|
|
299
|
+
if (this._callback != null) {
|
|
300
|
+
safeInvoke("onCurrentTimeChanged callback", () -> this._callback.onCurrentTimeChanged(currentTime));
|
|
301
|
+
}
|
|
302
|
+
if (this._audioView != null) {
|
|
303
|
+
this._audioView.setPlaying(false);
|
|
304
|
+
this._audioView.setCurrentTime(currentTime);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
});
|
|
249
308
|
}
|
|
250
309
|
|
|
251
310
|
@Override
|
|
252
311
|
public void onPlayerError(PlaybackException error) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
312
|
+
final String message = error == null ? "Playback error" : error.getMessage();
|
|
313
|
+
dispatchOnHandler("onPlayerError", () -> {
|
|
314
|
+
if (this._callback != null) {
|
|
315
|
+
safeInvoke("onError callback", () -> this._callback.onError(message));
|
|
316
|
+
}
|
|
317
|
+
});
|
|
256
318
|
}
|
|
257
319
|
|
|
258
320
|
@Override
|
|
259
321
|
public void onEvents(Player player, Player.Events events) { }
|
|
260
322
|
|
|
323
|
+
@Override
|
|
324
|
+
public void onTimelineChanged(Timeline timeline, @Player.TimelineChangeReason int reason) {}
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
@Override
|
|
328
|
+
public void onMediaItemTransition(
|
|
329
|
+
@Nullable MediaItem mediaItem, @Player.MediaItemTransitionReason int reason) {}
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
@Override
|
|
333
|
+
public void onTracksChanged(Tracks tracks) {}
|
|
334
|
+
|
|
335
|
+
@Override
|
|
336
|
+
public void onMediaMetadataChanged(MediaMetadata mediaMetadata) {}
|
|
337
|
+
|
|
338
|
+
@Override
|
|
339
|
+
public void onPlaylistMetadataChanged(MediaMetadata mediaMetadata) {}
|
|
340
|
+
|
|
341
|
+
@Override
|
|
342
|
+
public void onIsLoadingChanged(boolean isLoading) {}
|
|
343
|
+
|
|
344
|
+
@Deprecated
|
|
345
|
+
@UnstableApi
|
|
346
|
+
@Override
|
|
347
|
+
public void onLoadingChanged(boolean isLoading) {}
|
|
348
|
+
|
|
349
|
+
@Override
|
|
350
|
+
public void onAvailableCommandsChanged(Player.Commands availableCommands) {}
|
|
351
|
+
|
|
352
|
+
@Override
|
|
353
|
+
public void onTrackSelectionParametersChanged(TrackSelectionParameters parameters) {}
|
|
354
|
+
|
|
355
|
+
@Deprecated
|
|
356
|
+
@UnstableApi
|
|
357
|
+
@Override
|
|
358
|
+
public void onPlayerStateChanged(boolean playWhenReady, @Player.State int playbackState) {}
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
261
362
|
@Override
|
|
262
363
|
public void onPlaybackStateChanged(@Player.State int playbackState) {
|
|
263
364
|
if (playbackState == Player.STATE_READY) {
|
|
264
|
-
|
|
265
|
-
this._canPlayFired
|
|
266
|
-
|
|
267
|
-
this._callback
|
|
365
|
+
dispatchOnHandler("onPlaybackStateChanged", () -> {
|
|
366
|
+
if (!this._canPlayFired) {
|
|
367
|
+
this._canPlayFired = true;
|
|
368
|
+
if (this._callback != null) {
|
|
369
|
+
safeInvoke("onCanPlay callback", () -> this._callback.onCanPlay());
|
|
370
|
+
}
|
|
268
371
|
}
|
|
269
|
-
}
|
|
270
372
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
373
|
+
if (this._loadedDataFired.compareAndSet(false, true)) {
|
|
374
|
+
if (this._callback != null) {
|
|
375
|
+
safeInvoke("onLoadedData callback", () -> this._callback.onLoadedData());
|
|
376
|
+
}
|
|
274
377
|
}
|
|
275
|
-
}
|
|
276
378
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
if (duration > 0 && buffered >= duration - 1000 && !this._canPlayThroughFired) {
|
|
284
|
-
this._canPlayThroughFired = true;
|
|
285
|
-
if (this._callback != null) {
|
|
286
|
-
this._callback.onCanPlayThrough();
|
|
379
|
+
long duration = this._player.getDuration();
|
|
380
|
+
long buffered = this._player.getBufferedPosition();
|
|
381
|
+
if (this._audioView != null) {
|
|
382
|
+
this._audioView.setDuration(duration);
|
|
383
|
+
this._audioView.setCurrentTime(this._player.getCurrentPosition());
|
|
287
384
|
}
|
|
288
|
-
|
|
385
|
+
if (duration > 0 && buffered >= duration - 1000 && !this._canPlayThroughFired) {
|
|
386
|
+
this._canPlayThroughFired = true;
|
|
387
|
+
if (this._callback != null) {
|
|
388
|
+
safeInvoke("onCanPlayThrough callback", () -> this._callback.onCanPlayThrough());
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
});
|
|
289
392
|
}
|
|
290
393
|
}
|
|
291
394
|
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
@Override
|
|
398
|
+
public void onPlayWhenReadyChanged(
|
|
399
|
+
boolean playWhenReady, @Player.PlayWhenReadyChangeReason int reason) {}
|
|
400
|
+
|
|
401
|
+
@Override
|
|
402
|
+
public void onPlaybackSuppressionReasonChanged(
|
|
403
|
+
@Player.PlaybackSuppressionReason int playbackSuppressionReason) {}
|
|
404
|
+
|
|
405
|
+
@Override
|
|
406
|
+
public void onRepeatModeChanged(@Player.RepeatMode int repeatMode) {}
|
|
407
|
+
|
|
408
|
+
@Override
|
|
409
|
+
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {}
|
|
410
|
+
|
|
411
|
+
@Override
|
|
412
|
+
public void onPlayerErrorChanged(@Nullable PlaybackException error) {}
|
|
413
|
+
|
|
414
|
+
@Deprecated
|
|
415
|
+
@UnstableApi
|
|
416
|
+
@Override
|
|
417
|
+
public void onPositionDiscontinuity(@Player.DiscontinuityReason int reason) {}
|
|
418
|
+
|
|
419
|
+
@Override
|
|
420
|
+
public void onPositionDiscontinuity(
|
|
421
|
+
Player.PositionInfo oldPosition, Player.PositionInfo newPosition, @Player.DiscontinuityReason int reason) {}
|
|
422
|
+
|
|
423
|
+
@Override
|
|
424
|
+
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {}
|
|
425
|
+
|
|
426
|
+
@Override
|
|
427
|
+
public void onSeekBackIncrementChanged(long seekBackIncrementMs) {}
|
|
428
|
+
|
|
429
|
+
@Override
|
|
430
|
+
public void onSeekForwardIncrementChanged(long seekForwardIncrementMs) {}
|
|
431
|
+
|
|
432
|
+
@Override
|
|
433
|
+
public void onMaxSeekToPreviousPositionChanged(long maxSeekToPreviousPositionMs) {}
|
|
434
|
+
|
|
435
|
+
@UnstableApi
|
|
436
|
+
@Override
|
|
437
|
+
public void onAudioSessionIdChanged(int audioSessionId) {}
|
|
438
|
+
|
|
439
|
+
@Override
|
|
440
|
+
public void onAudioAttributesChanged(AudioAttributes audioAttributes) {}
|
|
441
|
+
|
|
442
|
+
@Override
|
|
443
|
+
public void onVolumeChanged(float volume) {}
|
|
444
|
+
|
|
445
|
+
@Override
|
|
446
|
+
public void onSkipSilenceEnabledChanged(boolean skipSilenceEnabled) {}
|
|
447
|
+
|
|
448
|
+
@Override
|
|
449
|
+
public void onDeviceInfoChanged(DeviceInfo deviceInfo) {}
|
|
450
|
+
|
|
451
|
+
@Override
|
|
452
|
+
public void onDeviceVolumeChanged(int volume, boolean muted) {}
|
|
453
|
+
|
|
454
|
+
@Override
|
|
455
|
+
public void onSurfaceSizeChanged(int width, int height) {}
|
|
456
|
+
|
|
457
|
+
@Override
|
|
458
|
+
public void onRenderedFirstFrame() {}
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
@Deprecated
|
|
462
|
+
@UnstableApi
|
|
463
|
+
@Override
|
|
464
|
+
public void onCues(List<Cue> cues) {}
|
|
465
|
+
|
|
466
|
+
@Override
|
|
467
|
+
public void onCues(CueGroup cueGroup) {}
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
@UnstableApi
|
|
471
|
+
public void onMetadata(Metadata metadata) {}
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
292
477
|
public void play() {
|
|
293
478
|
try {
|
|
294
479
|
this._player.setPlayWhenReady(true);
|
|
@@ -306,14 +491,21 @@ public class AudioHelper implements Player.Listener {
|
|
|
306
491
|
|
|
307
492
|
Method push = node.getClass().getMethod("pushFrames", float[].class);
|
|
308
493
|
Method end = node.getClass().getMethod("endStream");
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
494
|
+
Method configure = node.getClass().getMethod("configureFormat", int.class, int.class);
|
|
495
|
+
|
|
496
|
+
synchronized (_tapStateLock) {
|
|
497
|
+
_attachedContext = contextNative;
|
|
498
|
+
_ctxCreateExternalPcm = create;
|
|
499
|
+
_tapNodePushFrames = push;
|
|
500
|
+
_tapNodeEndStream = end;
|
|
501
|
+
_tapNodeConfigureFormat = configure;
|
|
502
|
+
_tapNodeSampleRate = 48000;
|
|
503
|
+
_tapNodeChannels = 2;
|
|
504
|
+
_tapReflectionFailures = 0;
|
|
505
|
+
_tapSuppressesDirectOutput = true;
|
|
506
|
+
_tapSourceNode = node;
|
|
507
|
+
}
|
|
508
|
+
updateEffectivePlayerVolume();
|
|
317
509
|
return node;
|
|
318
510
|
} catch (NoSuchMethodException e) {
|
|
319
511
|
android.util.Log.w("AudioHelper", "attachAudioContextTap: contextNative missing expected surface", e);
|
|
@@ -325,13 +517,23 @@ public class AudioHelper implements Player.Listener {
|
|
|
325
517
|
}
|
|
326
518
|
|
|
327
519
|
public void detachAudioContextTap() {
|
|
328
|
-
Object node
|
|
329
|
-
Method end
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
520
|
+
Object node;
|
|
521
|
+
Method end;
|
|
522
|
+
synchronized (_tapStateLock) {
|
|
523
|
+
node = _tapSourceNode;
|
|
524
|
+
end = _tapNodeEndStream;
|
|
525
|
+
_tapSourceNode = null;
|
|
526
|
+
_attachedContext = null;
|
|
527
|
+
_ctxCreateExternalPcm = null;
|
|
528
|
+
_tapNodePushFrames = null;
|
|
529
|
+
_tapNodeEndStream = null;
|
|
530
|
+
_tapNodeConfigureFormat = null;
|
|
531
|
+
_tapNodeSampleRate = 0;
|
|
532
|
+
_tapNodeChannels = 0;
|
|
533
|
+
_tapReflectionFailures = 0;
|
|
534
|
+
_tapSuppressesDirectOutput = false;
|
|
535
|
+
}
|
|
536
|
+
updateEffectivePlayerVolume();
|
|
335
537
|
if (node != null && end != null) {
|
|
336
538
|
try { end.invoke(node); } catch (Throwable ignored) {}
|
|
337
539
|
}
|
|
@@ -351,11 +553,12 @@ public class AudioHelper implements Player.Listener {
|
|
|
351
553
|
}
|
|
352
554
|
|
|
353
555
|
public boolean getMuted() {
|
|
354
|
-
return this.
|
|
556
|
+
return this._muted;
|
|
355
557
|
}
|
|
356
558
|
|
|
357
559
|
public void setMuted(boolean value) {
|
|
358
|
-
this.
|
|
560
|
+
this._muted = value;
|
|
561
|
+
updateEffectivePlayerVolume();
|
|
359
562
|
}
|
|
360
563
|
|
|
361
564
|
public long getDuration() {
|
package/video/common.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export declare abstract class VideoBase extends MediaBase {
|
|
|
34
34
|
_capturedListeners: {};
|
|
35
35
|
_listeners: {};
|
|
36
36
|
_notifyListener(type: any): void;
|
|
37
|
+
_invokeListener(type: string, listener: Function, source: string): void;
|
|
37
38
|
_removeListener(type: string, listener: Function, listeners: any): void;
|
|
38
39
|
_listenerExist(type: string, listener: Function, listeners: any): boolean;
|
|
39
40
|
addEventListener(type: string, listener: Function, useCapture: boolean | any): void;
|
package/video/common.js
CHANGED
|
@@ -6,6 +6,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { Screen, Application, Utils, CSSType, PercentLength } from '@nativescript/core';
|
|
8
8
|
import { MediaBase } from '../common';
|
|
9
|
+
function warnVideoListener(label, _error) {
|
|
10
|
+
try {
|
|
11
|
+
console.warn(label);
|
|
12
|
+
}
|
|
13
|
+
catch { }
|
|
14
|
+
}
|
|
9
15
|
let VideoBase = class VideoBase extends MediaBase {
|
|
10
16
|
constructor() {
|
|
11
17
|
super(...arguments);
|
|
@@ -60,24 +66,33 @@ let VideoBase = class VideoBase extends MediaBase {
|
|
|
60
66
|
for (let i = 0; i < size; i++) {
|
|
61
67
|
const item = capturedEvents[i];
|
|
62
68
|
if (typeof item === 'function') {
|
|
63
|
-
item
|
|
69
|
+
this._invokeListener(type, item, 'captured');
|
|
64
70
|
}
|
|
65
71
|
}
|
|
66
72
|
}
|
|
73
|
+
const handler = this[`on${type}`];
|
|
74
|
+
if (typeof handler === 'function') {
|
|
75
|
+
this._invokeListener(type, handler, 'property');
|
|
76
|
+
}
|
|
67
77
|
const events = this._listeners[type];
|
|
68
78
|
if (Array.isArray(events)) {
|
|
69
79
|
const size = events.length;
|
|
70
80
|
for (let i = 0; i < size; i++) {
|
|
71
81
|
const item = events[i];
|
|
72
|
-
if (typeof this[type] === 'function') {
|
|
73
|
-
this[type]();
|
|
74
|
-
}
|
|
75
82
|
if (typeof item === 'function') {
|
|
76
|
-
item
|
|
83
|
+
this._invokeListener(type, item, 'registered');
|
|
77
84
|
}
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
87
|
}
|
|
88
|
+
_invokeListener(type, listener, source) {
|
|
89
|
+
try {
|
|
90
|
+
listener.call(this);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
warnVideoListener(`Video.${type} ${source} listener failed`, error);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
81
96
|
_removeListener(type, listener, listeners) {
|
|
82
97
|
if (!this._listeners) {
|
|
83
98
|
this._listeners = {};
|
|
@@ -178,7 +193,7 @@ let VideoBase = class VideoBase extends MediaBase {
|
|
|
178
193
|
if (this._videoFrameCallbacks.length !== 0) {
|
|
179
194
|
const toRemove = this._videoFrameCallbacks.length;
|
|
180
195
|
this._videoFrameCallbacks.forEach((cb) => {
|
|
181
|
-
cb
|
|
196
|
+
this._invokeListener('videoframe', cb, 'registered');
|
|
182
197
|
});
|
|
183
198
|
this._videoFrameCallbacks.splice(0, toRemove);
|
|
184
199
|
}
|
package/video/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../packages/canvas-media/video/common.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE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