@nativescript/canvas-media 1.1.0 → 2.0.0-alpha.1
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.js.map +1 -1
- package/package.json +2 -3
- package/platforms/android/canvas_media.aar +0 -0
- package/platforms/android/java/org/nativescript/canvas/media/VideoHelper.java +663 -0
- package/platforms/android/res/layout/player.xml +2 -1
- package/video/common.js +12 -9
- package/video/common.js.map +1 -1
- package/video/index.android.d.ts +13 -24
- package/video/index.android.js +59 -276
- package/video/index.android.js.map +1 -1
- package/video/index.ios.js +5 -4
- package/video/index.ios.js.map +1 -1
- package/LICENSE +0 -201
package/video/common.js
CHANGED
|
@@ -119,6 +119,7 @@ let VideoBase = class VideoBase extends ContentView {
|
|
|
119
119
|
return has;
|
|
120
120
|
}
|
|
121
121
|
addEventListener(type, listener, useCapture) {
|
|
122
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
122
123
|
if (!this._listeners) {
|
|
123
124
|
this._listeners = {};
|
|
124
125
|
}
|
|
@@ -127,12 +128,12 @@ let VideoBase = class VideoBase extends ContentView {
|
|
|
127
128
|
isCapture = true;
|
|
128
129
|
}
|
|
129
130
|
else if (typeof useCapture === 'object') {
|
|
130
|
-
isCapture = useCapture
|
|
131
|
+
isCapture = (_a = useCapture === null || useCapture === void 0 ? void 0 : useCapture.capture) !== null && _a !== void 0 ? _a : false;
|
|
131
132
|
}
|
|
132
133
|
if (isCapture) {
|
|
133
134
|
if (!this._listenerExist(type, listener, this._capturedListeners)) {
|
|
134
|
-
if (Array.isArray(this._capturedListeners
|
|
135
|
-
this._capturedListeners
|
|
135
|
+
if (Array.isArray((_b = this._capturedListeners) === null || _b === void 0 ? void 0 : _b[type])) {
|
|
136
|
+
(_e = (_d = (_c = this._capturedListeners) === null || _c === void 0 ? void 0 : _c[type]) === null || _d === void 0 ? void 0 : _d.push) === null || _e === void 0 ? void 0 : _e.call(_d, listener);
|
|
136
137
|
}
|
|
137
138
|
else {
|
|
138
139
|
this._capturedListeners[type] = [listener];
|
|
@@ -141,8 +142,8 @@ let VideoBase = class VideoBase extends ContentView {
|
|
|
141
142
|
}
|
|
142
143
|
else {
|
|
143
144
|
if (!this._listenerExist(type, listener, this._listeners)) {
|
|
144
|
-
if (Array.isArray(this._listeners
|
|
145
|
-
this._listeners
|
|
145
|
+
if (Array.isArray((_f = this._listeners) === null || _f === void 0 ? void 0 : _f[type])) {
|
|
146
|
+
(_j = (_h = (_g = this._listeners) === null || _g === void 0 ? void 0 : _g[type]) === null || _h === void 0 ? void 0 : _h.push) === null || _j === void 0 ? void 0 : _j.call(_h, listener);
|
|
146
147
|
}
|
|
147
148
|
else {
|
|
148
149
|
this._listeners[type] = [listener];
|
|
@@ -151,17 +152,18 @@ let VideoBase = class VideoBase extends ContentView {
|
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
removeEventListener(type, listener, useCapture) {
|
|
155
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
154
156
|
let isCapture = false;
|
|
155
157
|
if (typeof useCapture === 'boolean') {
|
|
156
158
|
isCapture = true;
|
|
157
159
|
}
|
|
158
160
|
else if (typeof useCapture === 'object') {
|
|
159
|
-
isCapture = useCapture
|
|
161
|
+
isCapture = (_a = useCapture === null || useCapture === void 0 ? void 0 : useCapture.capture) !== null && _a !== void 0 ? _a : false;
|
|
160
162
|
}
|
|
161
163
|
if (isCapture) {
|
|
162
164
|
if (!this._listenerExist(type, listener, this._capturedListeners)) {
|
|
163
165
|
if (Array.isArray(this._capturedListeners[type])) {
|
|
164
|
-
this._capturedListeners
|
|
166
|
+
(_d = (_c = (_b = this._capturedListeners) === null || _b === void 0 ? void 0 : _b[type]) === null || _c === void 0 ? void 0 : _c.push) === null || _d === void 0 ? void 0 : _d.call(_c, listener);
|
|
165
167
|
}
|
|
166
168
|
else {
|
|
167
169
|
this._capturedListeners[type] = [listener];
|
|
@@ -171,7 +173,7 @@ let VideoBase = class VideoBase extends ContentView {
|
|
|
171
173
|
else {
|
|
172
174
|
if (!this._listenerExist(type, listener, this._listeners)) {
|
|
173
175
|
if (Array.isArray(this._listeners[type])) {
|
|
174
|
-
this._listeners
|
|
176
|
+
(_g = (_f = (_e = this._listeners) === null || _e === void 0 ? void 0 : _e[type]) === null || _f === void 0 ? void 0 : _f.push) === null || _g === void 0 ? void 0 : _g.call(_f, listener);
|
|
175
177
|
}
|
|
176
178
|
else {
|
|
177
179
|
this._listeners[type] = [listener];
|
|
@@ -180,8 +182,9 @@ let VideoBase = class VideoBase extends ContentView {
|
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
184
|
requestVideoFrameCallback(callback) {
|
|
185
|
+
var _a, _b;
|
|
183
186
|
if (typeof callback === 'function') {
|
|
184
|
-
this._videoFrameCallbacks
|
|
187
|
+
(_b = (_a = this._videoFrameCallbacks) === null || _a === void 0 ? void 0 : _a.push) === null || _b === void 0 ? void 0 : _b.call(_a, callback);
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
190
|
_notifyVideoFrameCallbacks() {
|
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,EAAuB,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACpH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../packages/canvas-media/video/common.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAuB,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACpH,OAAO,EAAE,QAAQ,EAAE,O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EH,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAEhC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,QAAQ,CAAoB;IAClE,IAAI,EAAE,aAAa;IACnB,YAAY,EAAE,CAAC;CACf,CAAC,CAAC;AAEH,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,QAAQ,CAAoB;IAC/D,IAAI,EAAE,UAAU;IAChB,YAAY,EAAE,GAAG;CACjB,CAAC,CAAC;AAEH,gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC"}
|
package/video/index.android.d.ts
CHANGED
|
@@ -1,42 +1,31 @@
|
|
|
1
1
|
import { VideoBase } from './common';
|
|
2
|
+
import { Source } from '..';
|
|
2
3
|
export declare class Video extends VideoBase {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
private static _msf;
|
|
10
|
-
private static _cdsf;
|
|
4
|
+
_container: android.widget.LinearLayout;
|
|
5
|
+
_sourceView: Source[];
|
|
6
|
+
_src: string;
|
|
7
|
+
_autoplay: boolean;
|
|
8
|
+
_loop: boolean;
|
|
9
|
+
_textureView: android.view.TextureView;
|
|
11
10
|
_isCustom: boolean;
|
|
12
11
|
_playing: boolean;
|
|
13
|
-
_timer: any;
|
|
14
|
-
_st: android.graphics.SurfaceTexture;
|
|
15
|
-
_surface: android.view.Surface;
|
|
16
|
-
_render: any;
|
|
17
|
-
_frameListener: any;
|
|
18
12
|
_canvas: any;
|
|
19
|
-
_frameTimer: any;
|
|
20
13
|
_readyState: number;
|
|
21
14
|
_videoWidth: number;
|
|
22
15
|
_videoHeight: number;
|
|
23
16
|
private static _didInit;
|
|
24
17
|
static BUFFER_MS: number;
|
|
25
18
|
static IS_DEBUG: boolean;
|
|
19
|
+
_instance: any;
|
|
26
20
|
constructor();
|
|
27
21
|
get readyState(): number;
|
|
28
|
-
_setSurface(surface: any): void;
|
|
29
|
-
private static getResourceId;
|
|
30
|
-
static st_count: number;
|
|
31
22
|
static createCustomView(): Video;
|
|
32
|
-
private _setSrc;
|
|
33
|
-
_hasFrame: boolean;
|
|
34
23
|
getCurrentFrame(context?: WebGLRenderingContext): void;
|
|
35
24
|
play(): void;
|
|
36
25
|
pause(): void;
|
|
37
26
|
get muted(): boolean;
|
|
38
27
|
set muted(value: boolean);
|
|
39
|
-
get duration():
|
|
28
|
+
get duration(): any;
|
|
40
29
|
get currentTime(): number;
|
|
41
30
|
set currentTime(value: number);
|
|
42
31
|
get src(): string;
|
|
@@ -51,9 +40,9 @@ export declare class Video extends VideoBase {
|
|
|
51
40
|
initNativeView(): void;
|
|
52
41
|
_addChildFromBuilder(name: string, value: any): void;
|
|
53
42
|
onLoaded(): void;
|
|
54
|
-
get width():
|
|
55
|
-
set width(value:
|
|
56
|
-
get height():
|
|
57
|
-
set height(value:
|
|
43
|
+
get width(): any;
|
|
44
|
+
set width(value: any);
|
|
45
|
+
get height(): any;
|
|
46
|
+
set height(value: any);
|
|
58
47
|
_layoutNative(): void;
|
|
59
48
|
}
|
package/video/index.android.js
CHANGED
|
@@ -1,172 +1,62 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _Video_container, _Video_sourceView, _Video_playerView, _Video_player, _Video_playerListener, _Video_src, _Video_autoplay, _Video_loop, _Video_textureView;
|
|
13
1
|
import { VideoBase, currentTimeProperty, durationProperty } from './common';
|
|
14
2
|
import { Screen, Application, knownFolders, path } from '@nativescript/core';
|
|
15
3
|
import { Source } from '..';
|
|
16
|
-
import { isString } from '@nativescript/core/utils/types';
|
|
17
|
-
const STATE_IDLE = 1;
|
|
18
|
-
const STATE_BUFFERING = 2;
|
|
19
|
-
const STATE_READY = 3;
|
|
20
|
-
const STATE_ENDED = 4;
|
|
21
|
-
const MATCH_PARENT = 0xffffffff;
|
|
22
|
-
const TYPE = { DETECT: 0, SS: 1, DASH: 2, HLS: 3, OTHER: 4 };
|
|
23
4
|
export class Video extends VideoBase {
|
|
24
5
|
constructor() {
|
|
25
6
|
super();
|
|
26
|
-
|
|
27
|
-
_Video_sourceView.set(this, []);
|
|
28
|
-
_Video_playerView.set(this, void 0);
|
|
29
|
-
_Video_player.set(this, void 0);
|
|
30
|
-
_Video_playerListener.set(this, void 0); //com.google.android.exoplayer2.Player.Listener;
|
|
31
|
-
_Video_src.set(this, void 0);
|
|
32
|
-
_Video_autoplay.set(this, void 0);
|
|
33
|
-
_Video_loop.set(this, void 0);
|
|
34
|
-
_Video_textureView.set(this, void 0);
|
|
7
|
+
this._sourceView = [];
|
|
35
8
|
this._isCustom = false;
|
|
36
9
|
this._playing = false;
|
|
37
10
|
this._readyState = 0;
|
|
38
11
|
this._videoWidth = 0;
|
|
39
12
|
this._videoHeight = 0;
|
|
40
|
-
this._hasFrame = false;
|
|
41
13
|
try {
|
|
42
14
|
java.lang.System.loadLibrary('canvasnative');
|
|
43
15
|
}
|
|
44
16
|
catch (ex) { }
|
|
45
17
|
const activity = Application.android.foregroundActivity || Application.android.startActivity;
|
|
46
|
-
|
|
47
|
-
const packageName = activity.getPackageName();
|
|
48
|
-
const cacheDir = new java.io.File(path.join(knownFolders.documents().path, 'MEDIA_PLAYER_CACHE'));
|
|
49
|
-
if (!cacheDir.exists()) {
|
|
50
|
-
cacheDir.mkdirs();
|
|
51
|
-
}
|
|
52
|
-
Video._leastRecentlyUsedCacheEvictor = new com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor(Video._exoPlayerCacheSize);
|
|
53
|
-
Video._exoDatabaseProvider = new com.google.android.exoplayer2.database.ExoDatabaseProvider(activity);
|
|
54
|
-
Video._cache = new com.google.android.exoplayer2.upstream.cache.SimpleCache(cacheDir, Video._leastRecentlyUsedCacheEvictor, Video._exoDatabaseProvider);
|
|
55
|
-
Video._dsf = new com.google.android.exoplayer2.upstream.DefaultDataSourceFactory(activity, com.google.android.exoplayer2.util.Util.getUserAgent(activity, packageName));
|
|
56
|
-
Video._cdsf = new com.google.android.exoplayer2.upstream.cache.CacheDataSource.Factory();
|
|
57
|
-
Video._cdsf.setCache(Video._cache);
|
|
58
|
-
Video._cdsf.setUpstreamDataSourceFactory(Video._dsf);
|
|
59
|
-
Video._msf = new com.google.android.exoplayer2.source.DefaultMediaSourceFactory(Video._cdsf);
|
|
60
|
-
Video._didInit = true;
|
|
61
|
-
}
|
|
62
|
-
const builder = new com.google.android.exoplayer2.SimpleExoPlayer.Builder(activity);
|
|
63
|
-
builder.setMediaSourceFactory(Video._msf);
|
|
64
|
-
const loadControl = new com.google.android.exoplayer2.DefaultLoadControl.Builder();
|
|
65
|
-
loadControl.setBufferDurationsMs(Video.BUFFER_MS, com.google.android.exoplayer2.DefaultLoadControl.DEFAULT_MAX_BUFFER_MS, Video.BUFFER_MS, Video.BUFFER_MS);
|
|
66
|
-
builder.setLoadControl(loadControl.build());
|
|
67
|
-
__classPrivateFieldSet(this, _Video_player, builder.build(), "f");
|
|
18
|
+
this._instance = new org.nativescript.canvas.media.VideoHelper(activity, knownFolders.documents().path);
|
|
68
19
|
const ref = new WeakRef(this);
|
|
69
|
-
|
|
70
|
-
|
|
20
|
+
this._instance.setCallback(new org.nativescript.canvas.media.VideoHelper.Callback({
|
|
21
|
+
onDurationChange(duration) {
|
|
71
22
|
const owner = ref.get();
|
|
72
23
|
if (owner) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
durationProperty.nativeValueChange(owner, duration);
|
|
76
|
-
owner._notifyListener(Video.durationchangeEvent);
|
|
77
|
-
}
|
|
78
|
-
owner._playing = isPlaying;
|
|
79
|
-
if (isPlaying) {
|
|
80
|
-
owner._notifyListener(Video.playingEvent);
|
|
81
|
-
owner._notifyVideoFrameCallbacks();
|
|
82
|
-
if (owner._timer) {
|
|
83
|
-
clearInterval(owner._timer);
|
|
84
|
-
}
|
|
85
|
-
if (owner._frameTimer) {
|
|
86
|
-
clearInterval(owner._frameTimer);
|
|
87
|
-
}
|
|
88
|
-
owner._timer = setInterval(function () {
|
|
89
|
-
const current = __classPrivateFieldGet(owner, _Video_player, "f").getCurrentPosition();
|
|
90
|
-
if (current != owner.currentTime) {
|
|
91
|
-
currentTimeProperty.nativeValueChange(owner, current);
|
|
92
|
-
owner._notifyListener(Video.timeupdateEvent);
|
|
93
|
-
owner._notifyVideoFrameCallbacks();
|
|
94
|
-
}
|
|
95
|
-
}, 1000);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
clearInterval(owner._timer);
|
|
99
|
-
clearInterval(owner._frameTimer);
|
|
100
|
-
currentTimeProperty.nativeValueChange(owner, __classPrivateFieldGet(owner, _Video_player, "f").getCurrentPosition());
|
|
101
|
-
}
|
|
24
|
+
durationProperty.nativeValueChange(owner, duration);
|
|
25
|
+
owner._notifyListener(Video.durationchangeEvent);
|
|
102
26
|
}
|
|
103
27
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
onPlayerStateChanged: function (playWhenReady, playbackState) { },
|
|
109
|
-
onPositionDiscontinuity: function (reason) { },
|
|
110
|
-
onRepeatModeChanged: function (repeatMode) { },
|
|
111
|
-
onSeekProcessed: function () { },
|
|
112
|
-
onShuffleModeEnabledChanged: function (shuffleModeEnabled) { },
|
|
113
|
-
//@ts-ignore
|
|
114
|
-
onTimelineChanged(timeline, manifest, reason) { },
|
|
115
|
-
onTracksChanged: function (trackGroups, trackSelections) { },
|
|
116
|
-
onPlayWhenReadyChanged(playWhenReady, reason) { },
|
|
117
|
-
onEvents(player, events) { },
|
|
118
|
-
onMediaItemTransition(mediaItem, reason) { },
|
|
119
|
-
onAvailableCommandsChanged(availableCommands) { },
|
|
120
|
-
onPlaybackStateChanged(playbackState) { },
|
|
121
|
-
onIsLoadingChanged(isLoading) { },
|
|
122
|
-
onPlayerErrorChanged(error) {
|
|
123
|
-
if (Video.IS_DEBUG) {
|
|
124
|
-
console.log(error);
|
|
28
|
+
onPlaying() {
|
|
29
|
+
const owner = ref.get();
|
|
30
|
+
if (owner) {
|
|
31
|
+
owner._notifyListener(Video.playingEvent);
|
|
125
32
|
}
|
|
126
33
|
},
|
|
127
|
-
|
|
128
|
-
onSurfaceSizeChanged(width, height) { },
|
|
129
|
-
onRenderedFirstFrame() { },
|
|
130
|
-
onDeviceVolumeChanged(volume, muted) { },
|
|
131
|
-
onVideoSizeChanged(videoSize) {
|
|
34
|
+
onVideoSizeChanged(width, height) {
|
|
132
35
|
const owner = ref.get();
|
|
133
36
|
if (owner) {
|
|
134
|
-
owner._videoWidth =
|
|
135
|
-
owner._videoHeight =
|
|
37
|
+
owner._videoWidth = width;
|
|
38
|
+
owner._videoHeight = height;
|
|
136
39
|
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
40
|
+
},
|
|
41
|
+
onCurrentTimeChanged(time) {
|
|
42
|
+
const owner = ref.get();
|
|
43
|
+
if (owner) {
|
|
44
|
+
currentTimeProperty.nativeValueChange(owner, time);
|
|
45
|
+
owner._notifyListener(Video.timeupdateEvent);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
onVideoFrame() {
|
|
49
|
+
const owner = ref.get();
|
|
50
|
+
if (owner) {
|
|
51
|
+
owner._notifyVideoFrameCallbacks();
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
}));
|
|
55
|
+
this.setNativeView(this._instance.getContainer());
|
|
148
56
|
}
|
|
149
57
|
get readyState() {
|
|
150
58
|
return this._readyState;
|
|
151
59
|
}
|
|
152
|
-
_setSurface(surface) {
|
|
153
|
-
__classPrivateFieldGet(this, _Video_player, "f").setVideoSurface(surface);
|
|
154
|
-
}
|
|
155
|
-
static getResourceId(context, res = '') {
|
|
156
|
-
if (!context)
|
|
157
|
-
return 0;
|
|
158
|
-
if (isString(res)) {
|
|
159
|
-
const packageName = context.getPackageName();
|
|
160
|
-
try {
|
|
161
|
-
const className = java.lang.Class.forName(`${packageName}.R$layout`);
|
|
162
|
-
return parseInt(String(className.getDeclaredField(res).get(null)));
|
|
163
|
-
}
|
|
164
|
-
catch (e) {
|
|
165
|
-
return 0;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return 0;
|
|
169
|
-
}
|
|
170
60
|
static createCustomView() {
|
|
171
61
|
const video = new Video();
|
|
172
62
|
video._isCustom = true;
|
|
@@ -174,136 +64,78 @@ export class Video extends VideoBase {
|
|
|
174
64
|
video.height = 150;
|
|
175
65
|
return video;
|
|
176
66
|
}
|
|
177
|
-
_setSrc(value) {
|
|
178
|
-
try {
|
|
179
|
-
if (typeof value === 'string' && value.startsWith('~/')) {
|
|
180
|
-
value = path.join(knownFolders.currentApp().path, value.replace('~', ''));
|
|
181
|
-
}
|
|
182
|
-
__classPrivateFieldGet(this, _Video_player, "f").setMediaItems(java.util.Arrays.asList([com.google.android.exoplayer2.MediaItem.fromUri(android.net.Uri.parse(value))]), true);
|
|
183
|
-
__classPrivateFieldGet(this, _Video_player, "f").prepare();
|
|
184
|
-
if (__classPrivateFieldGet(this, _Video_autoplay, "f")) {
|
|
185
|
-
__classPrivateFieldGet(this, _Video_player, "f").setPlayWhenReady(true);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
catch (e) {
|
|
189
|
-
if (Video.IS_DEBUG) {
|
|
190
|
-
console.log(e);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
67
|
getCurrentFrame(context) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (st) {
|
|
200
|
-
// @ts-ignore
|
|
201
|
-
this._render = org.nativescript.canvas.Utils.createRenderAndAttachToGLContext(context, st);
|
|
202
|
-
this._st = st;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if (!this._st) {
|
|
207
|
-
// @ts-ignore
|
|
208
|
-
const result = org.nativescript.canvas.Utils.createSurfaceTexture(context);
|
|
209
|
-
this._st = result[0];
|
|
210
|
-
const ref = new WeakRef(this);
|
|
211
|
-
this._frameListener = new android.graphics.SurfaceTexture.OnFrameAvailableListener({
|
|
212
|
-
onFrameAvailable(param0) {
|
|
213
|
-
const owner = ref.get();
|
|
214
|
-
if (owner) {
|
|
215
|
-
owner._hasFrame = true;
|
|
216
|
-
owner._notifyVideoFrameCallbacks();
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
});
|
|
220
|
-
this._st.setOnFrameAvailableListener(this._frameListener);
|
|
221
|
-
this._surface = new android.view.Surface(this._st);
|
|
222
|
-
__classPrivateFieldGet(this, _Video_player, "f").setVideoSurface(this._surface);
|
|
223
|
-
this._render = result[1];
|
|
224
|
-
}
|
|
225
|
-
if (this._st) {
|
|
226
|
-
if (!this._hasFrame) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
// @ts-ignore
|
|
230
|
-
org.nativescript.canvas.Utils.updateTexImage(context, this._st, this._render, this._videoWidth, this._videoHeight, arguments[4], arguments[5]);
|
|
231
|
-
this._hasFrame = false;
|
|
232
|
-
}
|
|
68
|
+
const ctx = arguments[1];
|
|
69
|
+
const flipY = ctx._flipY;
|
|
70
|
+
const ptr = ctx._canvas._canvas.getNativeGL();
|
|
71
|
+
this._instance.getCurrentFrame(!!this.isLoaded, ptr, flipY, arguments[4], arguments[5]);
|
|
233
72
|
}
|
|
234
73
|
play() {
|
|
235
|
-
|
|
74
|
+
this._instance.play();
|
|
236
75
|
}
|
|
237
76
|
pause() {
|
|
238
|
-
|
|
77
|
+
this._instance.pause();
|
|
239
78
|
}
|
|
240
79
|
get muted() {
|
|
241
|
-
return
|
|
80
|
+
return this._instance.getMuted();
|
|
242
81
|
}
|
|
243
82
|
set muted(value) {
|
|
244
|
-
|
|
83
|
+
this._instance.setMuted(value);
|
|
245
84
|
}
|
|
246
85
|
get duration() {
|
|
247
|
-
return
|
|
86
|
+
return this._instance.getDuration();
|
|
248
87
|
}
|
|
249
88
|
get currentTime() {
|
|
250
|
-
return
|
|
89
|
+
return this._instance.getCurrentTime();
|
|
251
90
|
}
|
|
252
91
|
set currentTime(value) {
|
|
253
|
-
|
|
92
|
+
this._instance.setCurrentTime(value);
|
|
254
93
|
}
|
|
255
94
|
get src() {
|
|
256
|
-
return
|
|
95
|
+
return this._instance.getSrc();
|
|
257
96
|
}
|
|
258
97
|
set src(value) {
|
|
259
|
-
|
|
260
|
-
|
|
98
|
+
if (typeof value === 'string' && value.startsWith('~/')) {
|
|
99
|
+
value = path.join(knownFolders.currentApp().path, value.replace('~', ''));
|
|
100
|
+
}
|
|
101
|
+
this._instance.setSrc(value);
|
|
261
102
|
}
|
|
262
103
|
//@ts-ignore
|
|
263
104
|
get autoplay() {
|
|
264
|
-
return
|
|
105
|
+
return this._instance.getAutoplay();
|
|
265
106
|
}
|
|
266
107
|
set autoplay(value) {
|
|
267
|
-
|
|
108
|
+
this._instance.setAutoplay(value);
|
|
268
109
|
}
|
|
269
110
|
get controls() {
|
|
270
|
-
return
|
|
111
|
+
return this._instance.getControls();
|
|
271
112
|
}
|
|
272
113
|
set controls(enabled) {
|
|
273
|
-
|
|
114
|
+
this._instance.setControls(enabled);
|
|
274
115
|
}
|
|
275
116
|
// @ts-ignore
|
|
276
117
|
get loop() {
|
|
277
|
-
return
|
|
118
|
+
return this._instance.getLoop();
|
|
278
119
|
}
|
|
279
120
|
set loop(value) {
|
|
280
|
-
|
|
281
|
-
if (value) {
|
|
282
|
-
__classPrivateFieldGet(this, _Video_player, "f").setRepeatMode(com.google.android.exoplayer2.Player.REPEAT_MODE_ALL);
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
__classPrivateFieldGet(this, _Video_player, "f").setRepeatMode(com.google.android.exoplayer2.Player.REPEAT_MODE_OFF);
|
|
286
|
-
}
|
|
121
|
+
this._instance.setLoop(value);
|
|
287
122
|
}
|
|
288
123
|
createNativeView() {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
__classPrivateFieldGet(this, _Video_playerView, "f").setPlayer(__classPrivateFieldGet(this, _Video_player, "f"));
|
|
293
|
-
return __classPrivateFieldGet(this, _Video_playerView, "f");
|
|
124
|
+
this._instance.setPlayer();
|
|
125
|
+
return this._instance.getPlayerView();
|
|
294
126
|
}
|
|
295
127
|
initNativeView() {
|
|
296
128
|
super.initNativeView();
|
|
297
129
|
}
|
|
298
130
|
_addChildFromBuilder(name, value) {
|
|
299
131
|
if (value instanceof Source) {
|
|
300
|
-
|
|
132
|
+
this._sourceView.push(value);
|
|
301
133
|
}
|
|
302
134
|
}
|
|
303
135
|
onLoaded() {
|
|
304
136
|
super.onLoaded();
|
|
305
|
-
if (
|
|
306
|
-
this.
|
|
137
|
+
if (this._sourceView.length > 0) {
|
|
138
|
+
this.src = this._sourceView[0].src;
|
|
307
139
|
}
|
|
308
140
|
}
|
|
309
141
|
// @ts-ignore
|
|
@@ -311,16 +143,7 @@ export class Video extends VideoBase {
|
|
|
311
143
|
if (this.getMeasuredWidth() > 0) {
|
|
312
144
|
return this.getMeasuredWidth();
|
|
313
145
|
}
|
|
314
|
-
|
|
315
|
-
const width = __classPrivateFieldGet(this, _Video_container, "f").getWidth();
|
|
316
|
-
if (width === 0) {
|
|
317
|
-
//@ts-ignore
|
|
318
|
-
let rootParams = __classPrivateFieldGet(this, _Video_container, "f").getLayoutParams();
|
|
319
|
-
if (rootParams) {
|
|
320
|
-
return rootParams.width;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
return width;
|
|
146
|
+
return this._instance.getWidth();
|
|
324
147
|
}
|
|
325
148
|
set width(value) {
|
|
326
149
|
this.style.width = value;
|
|
@@ -333,16 +156,7 @@ export class Video extends VideoBase {
|
|
|
333
156
|
if (this.getMeasuredHeight() > 0) {
|
|
334
157
|
return this.getMeasuredHeight();
|
|
335
158
|
}
|
|
336
|
-
|
|
337
|
-
const height = __classPrivateFieldGet(this, _Video_container, "f").getHeight();
|
|
338
|
-
if (height === 0) {
|
|
339
|
-
//@ts-ignore
|
|
340
|
-
let rootParams = __classPrivateFieldGet(this, _Video_container, "f").getLayoutParams();
|
|
341
|
-
if (rootParams) {
|
|
342
|
-
return rootParams.height;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
return height;
|
|
159
|
+
return this._instance.getHeight();
|
|
346
160
|
}
|
|
347
161
|
set height(value) {
|
|
348
162
|
this.style.height = value;
|
|
@@ -362,42 +176,11 @@ export class Video extends VideoBase {
|
|
|
362
176
|
const size = this._realSize;
|
|
363
177
|
size.width = size.width * Screen.mainScreen.scale;
|
|
364
178
|
size.height = size.height * Screen.mainScreen.scale;
|
|
365
|
-
|
|
366
|
-
let rootParams = __classPrivateFieldGet(this, _Video_container, "f").getLayoutParams();
|
|
367
|
-
if (rootParams && (size.width || 0) === rootParams.width && (size.height || 0) === rootParams.height) {
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
if ((size.width || 0) !== 0 && (size.height || 0) !== 0) {
|
|
371
|
-
if (!rootParams) {
|
|
372
|
-
rootParams = new android.widget.FrameLayout.LayoutParams(0, 0);
|
|
373
|
-
}
|
|
374
|
-
rootParams.width = size.width;
|
|
375
|
-
rootParams.height = size.height;
|
|
376
|
-
let surfaceParams; // = this._canvas.getSurface().getLayoutParams();
|
|
377
|
-
if (!surfaceParams) {
|
|
378
|
-
surfaceParams = new android.widget.FrameLayout.LayoutParams(0, 0);
|
|
379
|
-
}
|
|
380
|
-
// surfaceParams.width = size.width;
|
|
381
|
-
// surfaceParams.height = size.height;
|
|
382
|
-
//@ts-ignore
|
|
383
|
-
__classPrivateFieldGet(this, _Video_container, "f").setLayoutParams(rootParams);
|
|
384
|
-
const w = android.view.View.MeasureSpec.makeMeasureSpec(size.width, android.view.View.MeasureSpec.EXACTLY);
|
|
385
|
-
const h = android.view.View.MeasureSpec.makeMeasureSpec(size.height, android.view.View.MeasureSpec.EXACTLY);
|
|
386
|
-
//@ts-ignore
|
|
387
|
-
__classPrivateFieldGet(this, _Video_container, "f").measure(w, h);
|
|
388
|
-
//@ts-ignore
|
|
389
|
-
__classPrivateFieldGet(this, _Video_container, "f").layout(0, 0, size.width || 0, size.height || 0);
|
|
390
|
-
if (this._st) {
|
|
391
|
-
this._st.setDefaultBufferSize(size.width || 0, size.height || 0);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
179
|
+
this._instance.layoutNative(size.width, size.height);
|
|
394
180
|
}
|
|
395
181
|
}
|
|
396
182
|
}
|
|
397
|
-
_Video_container = new WeakMap(), _Video_sourceView = new WeakMap(), _Video_playerView = new WeakMap(), _Video_player = new WeakMap(), _Video_playerListener = new WeakMap(), _Video_src = new WeakMap(), _Video_autoplay = new WeakMap(), _Video_loop = new WeakMap(), _Video_textureView = new WeakMap();
|
|
398
|
-
Video._exoPlayerCacheSize = 100 * 1024 * 1024;
|
|
399
183
|
Video._didInit = false;
|
|
400
184
|
Video.BUFFER_MS = 500;
|
|
401
185
|
Video.IS_DEBUG = false;
|
|
402
|
-
Video.st_count = 0;
|
|
403
186
|
//# sourceMappingURL=index.android.js.map
|