multi_embed_player 3.0.1 → 3.1.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/CLAUDE.md +92 -0
- package/README.md +0 -24
- package/add_types.sh +61 -0
- package/dist/iframe_api/bilibili.d.ts +180 -61
- package/dist/iframe_api/bilibili.d.ts.map +1 -1
- package/dist/iframe_api/bilibili.js +938 -354
- package/dist/iframe_api/bilibili.js.map +1 -1
- package/dist/iframe_api/niconico.d.ts +177 -28
- package/dist/iframe_api/niconico.d.ts.map +1 -1
- package/dist/iframe_api/niconico.js +290 -146
- package/dist/iframe_api/niconico.js.map +1 -1
- package/dist/iframe_api/soundcloud.d.ts +132 -60
- package/dist/iframe_api/soundcloud.d.ts.map +1 -1
- package/dist/iframe_api/soundcloud.js +318 -146
- package/dist/iframe_api/soundcloud.js.map +1 -1
- package/dist/iframe_api/youtube.d.ts +32 -69
- package/dist/iframe_api/youtube.d.ts.map +1 -1
- package/dist/iframe_api/youtube.js +130 -139
- package/dist/iframe_api/youtube.js.map +1 -1
- package/dist/multi_embed_player.d.ts +193 -26
- package/dist/multi_embed_player.d.ts.map +1 -1
- package/dist/multi_embed_player.js +726 -123
- package/dist/multi_embed_player.js.map +1 -1
- package/package.json +10 -41
- package/dist/iframe_api/index.d.ts +0 -6
- package/dist/iframe_api/index.d.ts.map +0 -1
- package/dist/iframe_api/index.js +0 -8
- package/dist/iframe_api/index.js.map +0 -1
- package/dist/types.d.ts +0 -126
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -22
- package/dist/types.js.map +0 -1
|
@@ -1,181 +1,325 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// Notice! This file JSDOC is generated by gitHub copilot.
|
|
3
|
+
// So some of this JSDOC is not correct.
|
|
4
|
+
// Please refer to documents https://multi-embed-player.pages.dev/docs/reference/iframe_class/#mep_niconico-class
|
|
5
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
6
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7
|
+
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");
|
|
8
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9
|
+
};
|
|
10
|
+
var _mep_niconico_instances, _mep_niconico_postMessage, _mep_niconico_messageListener;
|
|
2
11
|
/**
|
|
3
12
|
* Class representing a Niconico player.
|
|
4
13
|
*/
|
|
5
|
-
|
|
14
|
+
class mep_niconico {
|
|
15
|
+
/**
|
|
16
|
+
* Create a Niconico player.
|
|
17
|
+
* @param {string|HTMLElement} replacing_element - The element to replace with the player.
|
|
18
|
+
* @param {Object} content - The content of the player.
|
|
19
|
+
* @param {Function} player_set_event_function - The function to set player events.
|
|
20
|
+
*/
|
|
6
21
|
constructor(replacing_element, content, player_set_event_function) {
|
|
7
|
-
this
|
|
22
|
+
_mep_niconico_instances.add(this);
|
|
23
|
+
/**
|
|
24
|
+
* The state of the player.
|
|
25
|
+
* @type {Object}
|
|
26
|
+
* @property {boolean} isRepeat - Whether the player is on repeat.
|
|
27
|
+
* @property {number} playerStatus - The status of the player.
|
|
28
|
+
*/
|
|
29
|
+
let element;
|
|
30
|
+
if (typeof replacing_element === "string") {
|
|
31
|
+
const found_element = document.getElementById(replacing_element);
|
|
32
|
+
if (!found_element) {
|
|
33
|
+
throw new Error(`Element with id "${replacing_element}" not found`);
|
|
34
|
+
}
|
|
35
|
+
element = found_element;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
element = replacing_element;
|
|
39
|
+
}
|
|
40
|
+
this.state = {
|
|
41
|
+
isRepeat: false,
|
|
42
|
+
playerStatus: 0
|
|
43
|
+
};
|
|
44
|
+
__classPrivateFieldGet(this, _mep_niconico_instances, "m", _mep_niconico_messageListener).call(this);
|
|
45
|
+
/**
|
|
46
|
+
* The start time of the player.
|
|
47
|
+
* @type {number}
|
|
48
|
+
*/
|
|
8
49
|
this.startSeconds = 0;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
50
|
+
if (content?.playerVars?.startSeconds != undefined) {
|
|
51
|
+
this.startSeconds = content?.playerVars?.startSeconds;
|
|
52
|
+
}
|
|
53
|
+
let niconico_doc = document.createElement("iframe");
|
|
54
|
+
niconico_doc.src = "https://embed.nicovideo.jp/watch/" + content["videoId"] + "?jsapi=1&playerId=" + String(mep_niconico.playerId) + "&from=" + String(this.startSeconds);
|
|
55
|
+
this.playerId = String(mep_niconico.playerId);
|
|
56
|
+
mep_niconico.playerId++;
|
|
57
|
+
niconico_doc.width = String(content["width"]);
|
|
58
|
+
niconico_doc.height = String(content["height"]);
|
|
59
|
+
niconico_doc.allow = "autoplay"; //fix bug not autoplay on chrome
|
|
60
|
+
niconico_doc.allowFullscreen = true; //fix bug can't watch on full screen(all browser)
|
|
61
|
+
niconico_doc.style.border = "none"; //fix bug display border on outer frame
|
|
62
|
+
element.replaceWith(niconico_doc);
|
|
63
|
+
/**
|
|
64
|
+
* The player element.
|
|
65
|
+
* @type {HTMLIFrameElement}
|
|
66
|
+
*/
|
|
67
|
+
this.player = niconico_doc;
|
|
19
68
|
if (typeof player_set_event_function === "function") {
|
|
20
|
-
player_set_event_function();
|
|
69
|
+
player_set_event_function(this.player);
|
|
21
70
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Whether the player is on autoplay.
|
|
73
|
+
* @type {boolean}
|
|
74
|
+
*/
|
|
75
|
+
this.autoplay_flag = false;
|
|
76
|
+
if (content?.playerVars?.autoplay == 1) { //終わり次第再生
|
|
77
|
+
this.autoplay_flag = true;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The end time of the player.
|
|
81
|
+
* @type {number}
|
|
82
|
+
*/
|
|
83
|
+
this.endSeconds = -1;
|
|
84
|
+
if (content?.playerVars?.endSeconds !== undefined) {
|
|
85
|
+
this.endSeconds = content?.playerVars?.endSeconds;
|
|
86
|
+
}
|
|
87
|
+
if (content?.playerVars?.displayComment !== undefined) {
|
|
88
|
+
if (content?.playerVars?.displayComment == 0) {
|
|
89
|
+
this.displayCommentMode = false;
|
|
27
90
|
}
|
|
28
|
-
|
|
91
|
+
else if (content?.playerVars?.displayComment == 1) {
|
|
92
|
+
this.displayCommentMode = true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Cue a video by ID.
|
|
98
|
+
* @param {mep_niconico_load_object} content - The content of the video.
|
|
99
|
+
*/
|
|
100
|
+
cueVideoById(content) {
|
|
101
|
+
this.startSeconds = 0;
|
|
102
|
+
if (content["startSeconds"] != undefined) {
|
|
103
|
+
this.startSeconds = content["startSeconds"];
|
|
104
|
+
}
|
|
105
|
+
this.endSeconds = -1;
|
|
106
|
+
if (content["endSeconds"] != undefined) {
|
|
107
|
+
this.endSeconds = content["endSeconds"];
|
|
108
|
+
}
|
|
109
|
+
this.player.src = "https://embed.nicovideo.jp/watch/" + content["videoId"] + "?jsapi=1&playerId=" + String(this.playerId) + "&from=" + String(this.startSeconds);
|
|
110
|
+
this.autoplay_flag = false;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Load a video by ID.
|
|
114
|
+
* @param {mep_niconico_load_object} content - The content of the video.
|
|
115
|
+
*/
|
|
116
|
+
loadVideoById(content) {
|
|
117
|
+
this.startSeconds = 0;
|
|
118
|
+
if (content["startSeconds"] != undefined) {
|
|
119
|
+
this.startSeconds = content["startSeconds"];
|
|
120
|
+
}
|
|
121
|
+
this.endSeconds = -1;
|
|
122
|
+
if (content["endSeconds"] != undefined) {
|
|
123
|
+
this.endSeconds = content["endSeconds"];
|
|
124
|
+
}
|
|
125
|
+
this.player.src = "https://embed.nicovideo.jp/watch/" + content["videoId"] + "?jsapi=1&playerId=" + String(this.playerId) + "&from=" + String(this.startSeconds);
|
|
126
|
+
this.autoplay_flag = true;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get the real duration of the video.
|
|
130
|
+
* @returns {number} The duration of the video.
|
|
131
|
+
*/
|
|
132
|
+
getRealDulation() {
|
|
133
|
+
if (this.endSeconds == -1) {
|
|
134
|
+
return this.getDuration() - this.startSeconds;
|
|
29
135
|
}
|
|
30
136
|
else {
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.startSeconds = playerVars.startSeconds || 0;
|
|
38
|
-
this.endSeconds = playerVars.endSeconds || -1;
|
|
39
|
-
// Set iframe attributes
|
|
40
|
-
this.player.width = String(content.width || 560);
|
|
41
|
-
this.player.height = String(content.height || 315);
|
|
42
|
-
this.player.allow = "autoplay; fullscreen";
|
|
43
|
-
this.player.allowFullscreen = true;
|
|
44
|
-
this.player.style.border = "none";
|
|
45
|
-
// Build URL with parameters
|
|
46
|
-
const params = new URLSearchParams();
|
|
47
|
-
params.set('v', this.videoid);
|
|
48
|
-
if (this.autoplay)
|
|
49
|
-
params.set('autoplay', '1');
|
|
50
|
-
if (this.startSeconds)
|
|
51
|
-
params.set('from', String(this.startSeconds));
|
|
52
|
-
if (this.endSeconds !== -1)
|
|
53
|
-
params.set('to', String(this.endSeconds));
|
|
54
|
-
if (playerVars.mute)
|
|
55
|
-
params.set('mute', '1');
|
|
56
|
-
if (playerVars.noRelatedVideo)
|
|
57
|
-
params.set('noRelatedVideo', '1');
|
|
58
|
-
if (playerVars.noLogo)
|
|
59
|
-
params.set('noLogo', '1');
|
|
60
|
-
if (playerVars.noController)
|
|
61
|
-
params.set('noController', '1');
|
|
62
|
-
if (playerVars.noHeader)
|
|
63
|
-
params.set('noHeader', '1');
|
|
64
|
-
if (playerVars.noTags)
|
|
65
|
-
params.set('noTags', '1');
|
|
66
|
-
if (playerVars.noShare)
|
|
67
|
-
params.set('noShare', '1');
|
|
68
|
-
this.player.src = `https://embed.nicovideo.jp/watch/${this.videoid}?${params.toString()}`;
|
|
69
|
-
// Replace element
|
|
70
|
-
iframe_replace_node.replaceWith(this.player);
|
|
71
|
-
// Dispatch ready event
|
|
72
|
-
setTimeout(() => {
|
|
73
|
-
this.player.dispatchEvent(new Event("onReady"));
|
|
74
|
-
}, 1000);
|
|
75
|
-
}
|
|
76
|
-
// IPlayer interface implementation
|
|
137
|
+
return this.endSeconds - this.startSeconds;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Play the video.
|
|
142
|
+
*/
|
|
77
143
|
playVideo() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
144
|
+
__classPrivateFieldGet(this, _mep_niconico_instances, "m", _mep_niconico_postMessage).call(this, {
|
|
145
|
+
eventName: 'play'
|
|
146
|
+
});
|
|
81
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Pause the video.
|
|
150
|
+
*/
|
|
82
151
|
pauseVideo() {
|
|
83
|
-
|
|
84
|
-
|
|
152
|
+
__classPrivateFieldGet(this, _mep_niconico_instances, "m", _mep_niconico_postMessage).call(this, {
|
|
153
|
+
eventName: 'pause'
|
|
154
|
+
});
|
|
85
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Get the current time of the video.
|
|
158
|
+
* @returns {number} The current time of the video.
|
|
159
|
+
*/
|
|
86
160
|
getCurrentTime() {
|
|
87
|
-
|
|
88
|
-
return Promise.resolve(this.currentTime);
|
|
161
|
+
return (this.state.currentTime ?? 0) / 1000; //msec->sec
|
|
89
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Get the duration of the video.
|
|
165
|
+
* @returns {number} The duration of the video.
|
|
166
|
+
*/
|
|
90
167
|
getDuration() {
|
|
91
|
-
|
|
92
|
-
return Promise.resolve(this.duration);
|
|
168
|
+
return (this.state.duration ?? 0) / 1000; //msec->sec
|
|
93
169
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// Update internal time tracking
|
|
101
|
-
this.currentTime = this.startSeconds + num_time;
|
|
102
|
-
console.log("Seek to - Niconico iframe doesn't support direct control");
|
|
170
|
+
/**
|
|
171
|
+
* Get the title of the video.
|
|
172
|
+
* @returns {string} The title of the video.
|
|
173
|
+
*/
|
|
174
|
+
getTitle() {
|
|
175
|
+
return this.state.videoInfo?.title ?? '';
|
|
103
176
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.volume = num_volume;
|
|
111
|
-
console.log("Set volume - Niconico iframe doesn't support direct control");
|
|
177
|
+
/**
|
|
178
|
+
* Check if the video is muted.
|
|
179
|
+
* @returns {boolean} Whether the video is muted.
|
|
180
|
+
*/
|
|
181
|
+
isMuted() {
|
|
182
|
+
return this.state.muted ?? false;
|
|
112
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Get the volume of the video.
|
|
186
|
+
* @returns {number} The volume of the video.
|
|
187
|
+
*/
|
|
113
188
|
getVolume() {
|
|
114
|
-
return
|
|
189
|
+
return Number(this.state.volume) * 100;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Seek to a specific time in the video.
|
|
193
|
+
* @param {number} seconds - The time to seek to.
|
|
194
|
+
*/
|
|
195
|
+
seekTo(seconds) {
|
|
196
|
+
__classPrivateFieldGet(this, _mep_niconico_instances, "m", _mep_niconico_postMessage).call(this, {
|
|
197
|
+
eventName: 'seek',
|
|
198
|
+
data: {
|
|
199
|
+
time: seconds * 1000 //secounds->msec
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Change the display comment mode of the video.
|
|
205
|
+
* @param {boolean} mode - The display comment mode to set.
|
|
206
|
+
*/
|
|
207
|
+
displayComment(mode) {
|
|
208
|
+
__classPrivateFieldGet(this, _mep_niconico_instances, "m", _mep_niconico_postMessage).call(this, {
|
|
209
|
+
eventName: "commentVisibilityChange",
|
|
210
|
+
data: {
|
|
211
|
+
commentVisibility: mode
|
|
212
|
+
}
|
|
213
|
+
});
|
|
115
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Mute the video.
|
|
217
|
+
*/
|
|
116
218
|
mute() {
|
|
117
|
-
this.
|
|
118
|
-
|
|
219
|
+
__classPrivateFieldGet(this, _mep_niconico_instances, "m", _mep_niconico_postMessage).call(this, {
|
|
220
|
+
eventName: "mute",
|
|
221
|
+
data: {
|
|
222
|
+
mute: true
|
|
223
|
+
}
|
|
224
|
+
});
|
|
119
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Unmute the video.
|
|
228
|
+
*/
|
|
120
229
|
unMute() {
|
|
121
|
-
this.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
230
|
+
__classPrivateFieldGet(this, _mep_niconico_instances, "m", _mep_niconico_postMessage).call(this, {
|
|
231
|
+
eventName: "mute",
|
|
232
|
+
data: {
|
|
233
|
+
mute: false
|
|
234
|
+
}
|
|
235
|
+
});
|
|
126
236
|
}
|
|
127
|
-
|
|
128
|
-
|
|
237
|
+
/**
|
|
238
|
+
* Set the volume of the video.
|
|
239
|
+
* @param {number} volume - The volume to set.
|
|
240
|
+
*/
|
|
241
|
+
setVolume(volume) {
|
|
242
|
+
__classPrivateFieldGet(this, _mep_niconico_instances, "m", _mep_niconico_postMessage).call(this, {
|
|
243
|
+
eventName: "volumeChange",
|
|
244
|
+
data: {
|
|
245
|
+
volume: volume / 100
|
|
246
|
+
}
|
|
247
|
+
});
|
|
129
248
|
}
|
|
130
249
|
/**
|
|
131
|
-
* Get
|
|
250
|
+
* Get the state of the player.
|
|
251
|
+
* @returns {number} The state of the player.
|
|
132
252
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return duration - this.startSeconds;
|
|
253
|
+
getPlayerState() {
|
|
254
|
+
if (this.getCurrentTime() >= this.getDuration() - 0.5 || (this.endSeconds != -1 && this.getCurrentTime() >= (this.endSeconds - 0.5))) { //最後まで行った
|
|
255
|
+
return 4;
|
|
137
256
|
}
|
|
138
257
|
else {
|
|
139
|
-
return this.
|
|
258
|
+
return this.state.playerStatus;
|
|
140
259
|
}
|
|
141
260
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Load video by ID.
|
|
144
|
-
*/
|
|
145
|
-
loadVideoById(content) {
|
|
146
|
-
this.videoid = content.videoId;
|
|
147
|
-
const playerVars = content.playerVars || {};
|
|
148
|
-
this.autoplay = playerVars.autoplay || 0;
|
|
149
|
-
this.startSeconds = playerVars.startSeconds || 0;
|
|
150
|
-
this.endSeconds = playerVars.endSeconds || -1;
|
|
151
|
-
// Reload iframe with new video
|
|
152
|
-
const params = new URLSearchParams();
|
|
153
|
-
params.set('v', this.videoid);
|
|
154
|
-
if (this.autoplay)
|
|
155
|
-
params.set('autoplay', '1');
|
|
156
|
-
if (this.startSeconds)
|
|
157
|
-
params.set('from', String(this.startSeconds));
|
|
158
|
-
if (this.endSeconds !== -1)
|
|
159
|
-
params.set('to', String(this.endSeconds));
|
|
160
|
-
this.player.src = `https://embed.nicovideo.jp/watch/${this.videoid}?${params.toString()}`;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Cue video by ID.
|
|
164
|
-
*/
|
|
165
|
-
cueVideoById(content) {
|
|
166
|
-
this.videoid = content.videoId;
|
|
167
|
-
const playerVars = content.playerVars || {};
|
|
168
|
-
this.autoplay = 0; // Don't autoplay when cueing
|
|
169
|
-
this.startSeconds = playerVars.startSeconds || 0;
|
|
170
|
-
this.endSeconds = playerVars.endSeconds || -1;
|
|
171
|
-
// Load without autoplay
|
|
172
|
-
const params = new URLSearchParams();
|
|
173
|
-
params.set('v', this.videoid);
|
|
174
|
-
if (this.startSeconds)
|
|
175
|
-
params.set('from', String(this.startSeconds));
|
|
176
|
-
if (this.endSeconds !== -1)
|
|
177
|
-
params.set('to', String(this.endSeconds));
|
|
178
|
-
this.player.src = `https://embed.nicovideo.jp/watch/${this.videoid}?${params.toString()}`;
|
|
179
|
-
}
|
|
180
261
|
}
|
|
262
|
+
_mep_niconico_instances = new WeakSet(), _mep_niconico_postMessage = function _mep_niconico_postMessage(request) {
|
|
263
|
+
const message = Object.assign({
|
|
264
|
+
sourceConnectorType: 1,
|
|
265
|
+
playerId: this.playerId
|
|
266
|
+
}, request);
|
|
267
|
+
if (this.player.contentWindow) {
|
|
268
|
+
this.player.contentWindow.postMessage(message, window.mep_niconico.origin);
|
|
269
|
+
}
|
|
270
|
+
}, _mep_niconico_messageListener = function _mep_niconico_messageListener() {
|
|
271
|
+
window.addEventListener('message', (e) => {
|
|
272
|
+
if (e.origin === window.mep_niconico.origin && e.data.playerId === this.playerId) {
|
|
273
|
+
const { data } = e.data;
|
|
274
|
+
switch (e.data.eventName) {
|
|
275
|
+
case 'statusChange': {
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
case 'error': {
|
|
279
|
+
this.player.dispatchEvent(new CustomEvent("onError", { detail: { code: 500 } }));
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
case 'playerMetadataChange': {
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
case 'loadComplete': {
|
|
286
|
+
if (this.autoplay_flag) {
|
|
287
|
+
this.playVideo();
|
|
288
|
+
}
|
|
289
|
+
this.player.dispatchEvent(new Event("onReady"));
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
case 'playerStatusChange': {
|
|
293
|
+
this.player.dispatchEvent(new CustomEvent("onStateChange", { detail: this.getPlayerState() }));
|
|
294
|
+
if (this.getCurrentTime() >= this.getDuration() - 0.5 || (this.endSeconds != -1 && this.getCurrentTime() >= (this.endSeconds - 0.5))) { //最後まで行った
|
|
295
|
+
this.player.dispatchEvent(new Event("onEndVideo"));
|
|
296
|
+
}
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
default:
|
|
300
|
+
console.log(e.data);
|
|
301
|
+
}
|
|
302
|
+
this.state = Object.assign({}, this.state, data);
|
|
303
|
+
if (this.endSeconds != -1 && (this.state.currentTime ?? 0) >= this.endSeconds * 1000) { //終了時間の時自動で停止
|
|
304
|
+
this.pauseVideo();
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* The ID of the player.
|
|
311
|
+
* @type {number}
|
|
312
|
+
*/
|
|
313
|
+
mep_niconico.playerId = 0;
|
|
314
|
+
/**
|
|
315
|
+
* The origin of the Niconico player.
|
|
316
|
+
* @type {string}
|
|
317
|
+
*/
|
|
318
|
+
mep_niconico.origin = 'https://embed.nicovideo.jp';
|
|
319
|
+
/**
|
|
320
|
+
* The result of checking local storage.
|
|
321
|
+
* @type {boolean}
|
|
322
|
+
*/
|
|
323
|
+
mep_niconico.localStorageCheck = null;
|
|
324
|
+
window.mep_niconico = mep_niconico;
|
|
181
325
|
//# sourceMappingURL=niconico.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"niconico.js","sourceRoot":"","sources":["../../iframe_api/niconico.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"niconico.js","sourceRoot":"","sources":["../../iframe_api/niconico.ts"],"names":[],"mappings":";AAAA,0DAA0D;AAC1D,wCAAwC;AACxC,iHAAiH;;;;;;;AAkGjH;;GAEG;AACH,MAAM,YAAY;IAwBd;;;;;OAKG;IACH,YAAY,iBAAuC,EAAE,OAA6B,EAAE,yBAA+D;;QAC/I;;;;;WAKG;QACH,IAAI,OAAoB,CAAC;QACzB,IAAG,OAAO,iBAAiB,KAAK,QAAQ,EAAC,CAAC;YACtC,MAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,iBAAiB,CA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