@reactoo/watchtogether-sdk-js 2.7.11 → 2.7.13
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/example/index.html
CHANGED
|
@@ -9,14 +9,7 @@
|
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div class="content">
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
12
|
<video id="thevideo" class="contentVideo" autoplay playsinline controls style="width: 400px" muted="muted" src="https://assetcdn.reactoo.com/watfordFc/Norwich_2010_B_roll_2min16_mute.mp4"></video>
|
|
18
|
-
<video id="thevideo2" class="contentVideo" autoplay playsinline controls style="width: 400px" muted="muted" src="https://assetcdn.reactoo.com/watfordFc/Norwich_2010_B_roll_2min16_mute.mp4"></video>
|
|
19
|
-
|
|
20
13
|
<div>
|
|
21
14
|
<button onclick="startRoom()">Connect and publish</button>
|
|
22
15
|
<button onclick="startRoom2()">Connect and publish with screen share</button>
|
|
@@ -37,91 +30,6 @@
|
|
|
37
30
|
|
|
38
31
|
<script>
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
function videoProxy(videoElementCollection) {
|
|
42
|
-
const handler = {
|
|
43
|
-
get: (target, prop, receiver) => {
|
|
44
|
-
if(prop === 'setAttribute') {
|
|
45
|
-
return (attribute, value) => {
|
|
46
|
-
videoElementCollection.forEach((video) => {
|
|
47
|
-
video.setAttribute(attribute, value);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if(prop === 'removeAttribute') {
|
|
53
|
-
return (attribute) => {
|
|
54
|
-
videoElementCollection.forEach((video) => {
|
|
55
|
-
video.removeAttribute(attribute);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if(prop === 'load') {
|
|
61
|
-
return () => {
|
|
62
|
-
videoElementCollection.forEach((video) => {
|
|
63
|
-
video.load();
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if(prop === 'play') {
|
|
69
|
-
return () => {
|
|
70
|
-
return Promise.all(videoElementCollection.map((video) => video.play()));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if(prop === 'pause') {
|
|
75
|
-
return () => {
|
|
76
|
-
videoElementCollection.forEach((video) => {
|
|
77
|
-
video.pause();
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return Reflect.get(target, prop);
|
|
82
|
-
},
|
|
83
|
-
set: (target, prop, value, receiver) => {
|
|
84
|
-
if(prop === 'src') {
|
|
85
|
-
videoElementCollection.forEach((video) => {
|
|
86
|
-
video.src = value;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if(prop === 'srcObject') {
|
|
91
|
-
videoElementCollection.forEach((video) => {
|
|
92
|
-
video.srcObject = value;
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if(prop === 'playbackRate') {
|
|
97
|
-
videoElementCollection.forEach((video) => {
|
|
98
|
-
video.playbackRate = value;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if(prop === 'currentTime') {
|
|
103
|
-
videoElementCollection.forEach((video) => {
|
|
104
|
-
video.currentTime = value;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if(prop === 'paused') {
|
|
109
|
-
videoElementCollection.forEach((video) => {
|
|
110
|
-
video.paused = value;
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return target[prop] = value;
|
|
115
|
-
|
|
116
|
-
// return Reflect.set(target, prop, value);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
return new Proxy(videoElementCollection[0], handler);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const cicka = videoProxy([document.getElementById('thevideo'), document.getElementById('thevideo2')]);
|
|
123
|
-
|
|
124
|
-
|
|
125
33
|
//https://studio.reactoo.com/room/edf441b3-7415-49c4-9557-273cb93bc746/LJj4W2Cz-nG3U-lb0R-TAaY-o7Thmb8xHSbE
|
|
126
34
|
|
|
127
35
|
let roomId = "c22ada04-6c95-4524-91d8-e915bcef2e61"; // It will create room automatically if not set
|
|
@@ -505,7 +413,7 @@
|
|
|
505
413
|
});
|
|
506
414
|
|
|
507
415
|
//attaching player
|
|
508
|
-
|
|
416
|
+
session.attachPlayer('hlsnative-vod',{videoElement:window.thevideo});
|
|
509
417
|
|
|
510
418
|
})
|
|
511
419
|
.catch(e => {
|
package/package.json
CHANGED
package/src/models/user.js
CHANGED
|
@@ -36,17 +36,17 @@ let user = function () {
|
|
|
36
36
|
.then(response => response.data.key)
|
|
37
37
|
;
|
|
38
38
|
},
|
|
39
|
-
uploadVideo: (roomId, files, privateAttributes = {}) => {
|
|
39
|
+
uploadVideo: (roomId, files, privateAttributes = {}, customPrice) => {
|
|
40
40
|
let id = generateUUID();
|
|
41
41
|
return this.__privates.auth.__client
|
|
42
42
|
.then(client => Promise.all([client, client.apis.video.initiateVideoUpload({id, segmentCount: files.length || 0})]))
|
|
43
43
|
.then(([client, response]) => Promise.all([client, response.data.signedUrlSegments.reduce((acc, url, index) => acc.then(() => client.http({url, method: response.data.httpMethod, headers: {"Content-Type":files[index].type}, body:files[index]})), Promise.resolve())]))
|
|
44
|
-
.then(([client]) => client.apis.video.publishVideo({_id:id, roomId}, {requestBody:{_id:id, roomId, privateAttributes}}))
|
|
44
|
+
.then(([client]) => client.apis.video.publishVideo({_id:id, roomId, customPrice}, {requestBody:{_id:id, roomId, privateAttributes, customPrice}}))
|
|
45
45
|
},
|
|
46
46
|
|
|
47
|
-
publishVideo: (roomId, id, privateAttributes = {}) => {
|
|
47
|
+
publishVideo: (roomId, id, privateAttributes = {}, customPrice) => {
|
|
48
48
|
return this.__privates.auth.__client
|
|
49
|
-
.then(client => client.apis.video.publishVideo({_id:id, roomId}, {requestBody:{_id:id, roomId, privateAttributes}}))
|
|
49
|
+
.then(client => client.apis.video.publishVideo({_id:id, roomId, customPrice}, {requestBody:{_id:id, roomId, privateAttributes}}))
|
|
50
50
|
},
|
|
51
51
|
|
|
52
52
|
getReactionById: (id) => {
|