Closed omaralcheikh closed 6 years ago
It is relatively simple. I can have something working by next week if you're interested in using it.
Yes please that would be amazing. Thank you
Hello Cristi,
Did you have the chance to work on this?
Sorry, higher priority work popped up. I don't have an ETA but it will be the first thing I do on HoloJS once I get a little bit of time.
I've added the concept of spatial anchors to HoloJS. Checkout the develop/spatial-anchors branch. There is a ThreeJS example called spatial-anchors that shows how to create, delete, save, enumerate and get location of anchors. I will add import/export of said anchors in the next couple of days to enable sharing of anchors with other devices.
I added import/export as well. I'll do some cleanup and write a Wiki entry, but the intended functionality is done. Please give it a try and let me know if you encounter any issues.
Hello Cristi, Thank you for the update. I am trying to send the exported anchor over a socket connection in order to share it with multiple devices. However when doing something like this
var data = {
buffer : result.anchorBuffer,
name: "exportedCubeLocation"
}
socket.emit('sendAnchor', data);
I get the following error:
Exception thrown at 0x76CA2552 in ThreeJSApp-Vs2017.exe: Microsoft C++ exception: Js::JavascriptExceptionObject at memory location 0x0200C454.
TypeError: Object doesn't support property or method 'btoa'
at e.encodeBase64Packet (socket.io.js:2:10105)
at o (socket.io.js:2:8224)
at e.encodePacket (socket.io.js:2:9510)
at Anonymous function (socket.io.js:2:22461)
at r.prototype.write (socket.io.js:2:22449)
at r.prototype.send (socket.io.js:2:7770)
at r.prototype.flush (socket.io.js:1:29319)
at r.prototype.onDrain (socket.io.js:1:29162)
at Anonymous function (socket.io.js:1:25677)
at r.prototype.emit (socket.io.js:1:12370)
btoa is not implemented on the window element. I'm currently on vacation and can't add it for the next one week.
Meanwhile, you can try sending binary messages with socket.io as they don't require encoding with btoa:
After creating the socket:
socket.binaryType = "arraybuffer";
You can switch back to text messages:
socket.binaryType = "";
Ok Cristi thank you. Enjoy your vacation :)
I implemented btoa and atob. Base64 encoding should work for socket.io now. However, sending binary messages will be much more efficient. Exported anchor size is in the megabytes range and base64 encoding/decoding these buffers will take some time.
Hello,
How easy would it be to add shared experiences capabilities (Spatial anchoring) to HoloJs.
Regards, Omar.