@momo2555/koppeliajs 0.0.127 → 0.0.128
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.
|
@@ -67,6 +67,14 @@ export declare class Console {
|
|
|
67
67
|
*/
|
|
68
68
|
get ready(): boolean;
|
|
69
69
|
getMediaUrl(path: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Call thus function to fix the link and make it work for both controller and monitor
|
|
72
|
+
* Sometimes, the link is get from monitor or controller and save as a game state. But
|
|
73
|
+
* When the oher client will get the link will not work. Using this function for all media
|
|
74
|
+
* Url is a good practice.
|
|
75
|
+
* @param mediaUrl
|
|
76
|
+
*/
|
|
77
|
+
fixMediaUrl(mediaUrl: string): string;
|
|
70
78
|
getMedia(path: string): Promise<MediaResponseData>;
|
|
71
79
|
private _initEvents;
|
|
72
80
|
private _processReceivedData;
|
package/dist/scripts/console.js
CHANGED
|
@@ -115,6 +115,20 @@ export class Console {
|
|
|
115
115
|
path = "/" + path;
|
|
116
116
|
return this._mediaApiUrl + path;
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Call thus function to fix the link and make it work for both controller and monitor
|
|
120
|
+
* Sometimes, the link is get from monitor or controller and save as a game state. But
|
|
121
|
+
* When the oher client will get the link will not work. Using this function for all media
|
|
122
|
+
* Url is a good practice.
|
|
123
|
+
* @param mediaUrl
|
|
124
|
+
*/
|
|
125
|
+
fixMediaUrl(mediaUrl) {
|
|
126
|
+
let url = new URL(mediaUrl);
|
|
127
|
+
let fixedurl = new URL(this._mediaApiUrl);
|
|
128
|
+
fixedurl.pathname = url.pathname;
|
|
129
|
+
fixedurl.search = url.search;
|
|
130
|
+
return fixedurl.toString();
|
|
131
|
+
}
|
|
118
132
|
async getMedia(path) {
|
|
119
133
|
const response = await fetch(this.getMediaUrl(path));
|
|
120
134
|
if (!response.ok) {
|
package/dist/scripts/koppelia.js
CHANGED