Skip to content

Commit 1c2bf4e

Browse files
authored
Merge pull request #2 from BIVROST/webxr
Webxr
2 parents 7c42d02 + 8572db5 commit 1c2bf4e

File tree

7 files changed

+30764
-27790
lines changed

7 files changed

+30764
-27790
lines changed

DEVELOPMENT.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,28 @@ rm compiler-latest.zip
2929
popd
3030
```
3131

32-
Note: on some systems, `gem` commands might require administrator privileges:
32+
Note: on some systems, `gem` and `npm install -g` commands might require administrator privileges:
3333
```bash
3434
sudo gem install sass
3535
sudo gem install compass
36+
sudo npm install -g grunt-cli
3637
```
3738

3839
On recent MacOS, you might need to install `compass` to a different directory if using pre-installed ruby:
3940
```
4041
sudo gem install -n /usr/local/bin compass
4142
```
4243

44+
On WSL/ubuntu, `ruby-dev` is required for sass installation.
45+
```
46+
sudo apt-get install ruby-dev
47+
```
48+
49+
Java JRE is required for Google Closure Compiler:
50+
```
51+
sudo apt install openjdk-8-jre-headless
52+
```
53+
4354

4455
Build the project
4556
-----------------

README.md

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -67,31 +67,33 @@ If you're interested in older releases, checkout [the Tags tab][download-link-ta
6767
Supported browsers
6868
------------------
6969

70-
71-
| OS | Browser | Panorama viewing | Video playback | Video streaming (HLS) | Legacy VR⁵ | WebVR | Headsets supported |
72-
| ------- | --------------------------- |:----------------:|:--------------:|:---------------------:|:----------:|:-----:| ------------------------------------------ |
73-
| Windows | Google Chrome |||| | ✔¹ | Oculus, Vive, Windows Mixed Reality⁶ |
74-
| Windows | Mozilla Firefox |||| | ✔² | Oculus, OSVR, Vive, Windows Mixed Reality⁶ |
75-
| Windows | Microsoft Edge |||| || Windows Mixed Reality, Hololens⁷ |
76-
| Windows | Internet Explorer (11+) |||| | | |
77-
| Mac OS | Safari || ✔⁴ || | | |
78-
| Mac OS | Google Chrome |||| | | |
79-
| Mac OS | Mozilla Firefox |||| | | |
80-
| Android | Mozilla Firefox |||| | | |
81-
| Android | Google Chrome ||||| ✔³ | Cardboard |
82-
| Android | Samsung Internet ||| || | Cardboard |
83-
| Android | Samsung Internet for GearVR |||| || GearVR |
84-
| iOS | Safari ||| || | Cardboard |
85-
| iOS | Google Chrome ||| || | Cardboard |
86-
| iOS | Mozilla Firefox ||| | | | |
70+
| OS | Browser | Panorama viewing | Video playback | Video streaming (HLS) | WebXR | Legacy VR⁵ | legacy WebVR | Headsets supported |
71+
| ------- | --------------------------- |:----------------:|:--------------:|:---------------------:|:-----:|:----------:|:------------:| ------------------------------------------ |
72+
| Windows | Google Chrome ||||| | ✔¹ | Oculus, Vive, Windows Mixed Reality⁶ |
73+
| Windows | Mozilla Firefox |||| ✔⁸ | | ✔² | Oculus, OSVR, Vive, Windows Mixed Reality⁶ |
74+
| Windows | Microsoft Edge ||||| || Windows Mixed Reality, Hololens⁷ |
75+
| Windows | Internet Explorer (11+) |||| | | | |
76+
| Mac OS | Safari || ✔⁴ || | | | |
77+
| Mac OS | Google Chrome |||| | | | |
78+
| Mac OS | Mozilla Firefox |||| | | | |
79+
| Android | Google Chrome |||||| ✔³ | Cardboard |
80+
| Android | Mozilla Firefox |||| | | | |
81+
| Android | Samsung Internet ||| | || | Cardboard |
82+
| Android | Samsung Internet for GearVR ||||| || GearVR |
83+
| iOS | Safari ||| | || | Cardboard |
84+
| iOS | Google Chrome ||| | || | Cardboard |
85+
| iOS | Mozilla Firefox ||| | | | | |
8786

8887
¹ - With a [dedicated WebVR Chromium build][webvr-chromium] or [Chrome Canary][webvr-chrome-canary]
8988
² - With [Firefox Nightly][webvr-firefox]
9089
³ - Requires enabling VR in `chrome://flags/#enable-webvr`
9190
⁴ - Movies must be on the same domain ([broken CORS implementation][video-does-not-work])
9291
⁵ - Split screen with orientation sensor support (basic Cardboard)
9392
⁶ - Windows Mixed Reality support via Microsoft's Windows Mixed Reality for SteamVR
94-
⁷ - Requires enabling WebVR in `about:flags`
93+
⁷ - Requires enabling WebVR in `about:flags`
94+
⁸ - Requires enabling WebXR in `about:flags` or using Firefox Reality
95+
96+
Note: some of these test results might be out of date.
9597

9698
[video-does-not-work]: #video-does-not-work
9799

@@ -136,6 +138,7 @@ Installation
136138
Don't forget to set the correct paths.
137139
3. [Configure the video player][configuration]
138140
4. [Encode media][media-preparation-guide]
141+
5. Make sure you serve the player and the page you're hosting it from on HTTPS. WebXR and gyroscope (orientation) features are disabled on non secure origins. Host media from the same server or enable [CORS][cors].
139142

140143
[configuration]: #configuration
141144
[media-preparation-guide]: #media-preparation-guide
@@ -530,7 +533,7 @@ BIVROST Analytics for VR integration
530533
------------------------------------
531534

532535
The 360WebPlayer has a built-in support for gathering user analytics, just like the other BIVROST players.
533-
For more information about BIVROST Analytics for VR, please contact us at [contact@bivrost360.com][email-sales].
536+
For more information about BIVROST Analytics for VR, please contact us at [contact@bivrost.pro][email-sales].
534537

535538
Analytics works only with videos.
536539
It does not work with static images (panoramas) or with infinite live streams.
@@ -654,6 +657,7 @@ You can distinguish between the sessions with the `lookprovider` field of the se
654657
Look providers generated by the player:
655658
* `bivrost:360WebPlayer:main-display` - gathered by the mono renderer - the classical desktop or mobile mode.
656659
* `bivrost:360WebPlayer:webvr` - gathered by the WebVR view.
660+
* `bivrost:360WebPlayer:webxr` - gathered by the WebXR view.
657661
* `bivrost:360WebPlayer:legacy-stereo` - gathered by the legacy Stereo view (Cardboard support).
658662

659663

@@ -671,10 +675,24 @@ User Guide
671675
* ` [ `, ` ] ` - scroll movie by 5 seconds, forwards or backwards.
672676
* ` + `, ` - ` - zoom in/out (not available in VR mode).
673677

678+
### Virtual Reality on desktop and mobile with WebXR
674679

675-
### Virtual Reality on desktop and mobile with WebVR
680+
WebXR is the new browser Virtual Reality standard. It has built in support on major platforms including:
676681

677-
At the time of writing, WebVR is supported by Microsoft Edge, [Firefox Nightly][webvr-firefox], special [Windows builds of Chromium][webvr-chromium] and [Chrome Canary][webvr-chrome-canary], Google Chrome on Android with Cardboard (after enabling WebVR in `chrome://flags/#enable-webvr`) and [Samsung Internet Browser for Gear VR][webvr-samsung].
682+
- Chrome for Windows
683+
- Chrome for Android
684+
- Microsoft Edge (Chromium) for Windows 10
685+
- Firefox Reality
686+
687+
When you have a supported platform, an headset button will be visible in 360WebPlayer - press it to enter VR.
688+
689+
690+
### Virtual Reality on desktop and mobile with legacy WebVR support
691+
692+
WebXR is currently disabled in all new browsers and is superseded by WebXR.
693+
It has been left as a legacy fallback for devices that still might support it.
694+
695+
WebVR was supported by Microsoft Edge, [Firefox Nightly][webvr-firefox], special [Windows builds of Chromium][webvr-chromium] and [Chrome Canary][webvr-chrome-canary], Google Chrome on Android with Cardboard (after enabling WebVR in `chrome://flags/#enable-webvr`) and [Samsung Internet Browser for Gear VR][webvr-samsung].
678696

679697
When you have a supported platform, an headset button will be visible in 360WebPlayer - press it to enter VR.
680698

@@ -690,6 +708,9 @@ For more platform specific instructions look at the [WebVR][webvr] website.
690708

691709
### Virtual Reality on mobile with legacy Google Cardboard support
692710

711+
Most current Android devices are able to use WebXR which has better overall user experience.
712+
This is a legacy fallback for mobile devices that have orientation sensors but do not support WebXR.
713+
693714
You can use the Bivrost 360WebPlayer with Google Cardboard and its many clones with a simple split screen. Just press the "headset" button to go to VR mode.
694715

695716
Contrary to most players, you don't have to enable screen rotation for 360WebPlayer to work properly in cardboard mode. The phone can be in both landscape or portrait mode.
@@ -726,6 +747,10 @@ Either your webserver doesn't support [Content-Range][content-range] or there ar
726747

727748
[content-range]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16
728749

750+
### WebXR or legacy cardboard VR does not work on my page, but does work on other pages
751+
752+
Force HTTPS on all pages embedding the player. Orientation events, WebXR and other features do not work on non-secure origins.
753+
This is a standards-backed security requirement implemented by current browsers.
729754

730755
### Where can I submit feature requests or bug reports? Where can I find the unminified version?
731756

@@ -753,12 +778,14 @@ Please [contact sales at contact@bivrost360.com][email-sales] for more details.
753778
License
754779
-------
755780

756-
Terms and conditions are [available in a separate document (english)](LICENSE.md) [(polish)](LICENSE-polish.md).
781+
This software is free and can be used only for noncommercial purposes. To purchase the commercial license read the terms and contact us: [contact@bivrost.pro][email-sales]
782+
783+
Terms and conditions are [available in a separate document [English]](LICENSE.md) [[Polish]](LICENSE-polish.md).
757784

758785
If you want to remove or replace our branding, are unsure about which license applies to you, please [contact us for help and additional licensing options][email-sales].
759786

760787
[section-license]: #License
761-
[email-sales]: mailto:contact@bivrost360.com
788+
[email-sales]: mailto:contact@bivrost.pro
762789

763790

764791
### Third party libraries
@@ -778,13 +805,13 @@ The BIVROST 360WebPlayer can be optionaly made to use third party libraries:
778805
Changelog
779806
---------
780807

781-
* 2016-03-14: initial public release
808+
* 2016-03-14: initial public release (version 1.0)
782809
* 2016-09-21: WebVR 1.1 support
783810
* 2016-12-21: GearVR support, stereo UI
784811
* 2016-12-30: Documentation update
785812
* 2016-12-31: GitHub release
786813
* 2018-01-26: Move to GitLab, updated documentation
787814
* 2018-08-08: Moved back to GitHub, updated logo
788815
* 2019-04-05: Updated logo
789-
* 2020-07-16: Fixed issues with iOS 13 fullscreen and gyroscope
790-
* 2020-08-06: License updated
816+
* 2020-07-16: Fixed issues with iOS 13 fullscreen and gyroscope (version 1.1)
817+
* 2020-08-06: WebXR support, license updated (version 1.2)

scripts.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"src/bivrost-renderer-mono.js",
2525
"src/bivrost-renderer-stereo.js",
2626
"src/bivrost-renderer-webvr.js",
27+
"src/bivrost-renderer-webxr.js",
2728
"src/IEVideoTexture.js",
2829
"src/bivrost-analytics.js"
2930
]

src/bivrost-input.js

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@
273273
this.__initGyroscope(player);
274274

275275

276-
// WebVR support
276+
// WebXR and legacy WebVR support
277+
this.__initWebXR(player);
277278
this.__initWebVR(player);
278279
};
279280

@@ -674,6 +675,50 @@
674675

675676

676677

678+
/// REGION: WebXR
679+
{
680+
Bivrost.Input.prototype.xrAvailable = false;
681+
// Bivrost.Input.prototype.vrDisplaySize = { x:undefined, y:undefined };
682+
683+
/**
684+
* Initiates WebXR support
685+
* @param {Bivrost.Input} input
686+
* @param {Bivrost.Player} player
687+
*/
688+
Bivrost.Input.prototype.__initWebXR=function(input, player) {
689+
if(!navigator.xr) {
690+
log("WebVR: WebVR not supported");
691+
return;
692+
}
693+
694+
var input=this;
695+
696+
navigator.xr.isSessionSupported('immersive-vr').then(function(supported) {
697+
if (supported) {
698+
// input.vrDisplay = displays[0];
699+
700+
// var eyeLeft = input.vrDisplay.getEyeParameters("left");
701+
// var eyeRight = input.vrDisplay.getEyeParameters("right");
702+
703+
// var width = eyeLeft.renderWidth + eyeRight.renderWidth;
704+
// var height = Math.max(eyeLeft.renderWidth, eyeRight.renderWidth);
705+
706+
// input.vrDisplaySize.x=width;
707+
// input.vrDisplaySize.y=height;
708+
709+
// log("WebVR: Found VR Display with size: "+width+"x"+height);
710+
// input.onInputMethodAdded.publish(input);
711+
input.xrAvailable = true;
712+
log("WebXR: supported")
713+
}
714+
else {
715+
log("WebXR: No VR Displays found");
716+
}
717+
});
718+
};
719+
}
720+
721+
677722
/// REGION: Gyroscope
678723
{
679724
/**

src/bivrost-player.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868

6969
// renderer
7070
this.webglRenderer=new THREE.WebGLRenderer({ antialias: true });
71+
this.webglRenderer.xr.enabled = true;
72+
this.webglRenderer.xr.setReferenceSpaceType( 'local' );
73+
7174
this.webglRenderer.setClearColor(0x000000, 1); // iOS doesn't have this set up as proper default
7275
container.appendChild(this.webglRenderer.domElement);
7376

@@ -100,9 +103,9 @@
100103
function mainloopBound() {
101104
var dt=clock.getDelta();
102105
thisRef.mainLoop(dt);
103-
requestAnimationFrame(mainloopBound);
104106
};
105-
requestAnimationFrame(mainloopBound);
107+
this.webglRenderer.setAnimationLoop(mainloopBound);
108+
106109
};
107110

108111

@@ -297,6 +300,7 @@
297300
Bivrost.Player.prototype.vrModeEnterOrCycle=function() {
298301
var player=this;
299302
var vrModes=[
303+
Bivrost.Renderer.WebXR,
300304
Bivrost.Renderer.WebVR,
301305
Bivrost.Renderer.Stereo
302306
].filter(function(r) { return r.shouldWork(player); });
@@ -310,12 +314,19 @@
310314
vrMode=vrModes[0];
311315
log("selecting default VR mode");
312316
}
313-
// already in vr mode - toggle next available mode
317+
// already in vr mode - reset to mono
314318
else {
315-
var index=(vrModes.indexOf(this.renderer.__proto__) + 1) % vrModes.length;
316-
vrMode=vrModes[index];
317-
log("selecting next VR mode");
319+
log("back to mono");
320+
this.vrExit();
321+
return;
318322
}
323+
324+
// // already in vr mode - toggle next available mode
325+
// else {
326+
// var index=(vrModes.indexOf(this.renderer.__proto__) + 1) % vrModes.length;
327+
// vrMode=vrModes[index];
328+
// log("selecting next VR mode");
329+
// }
319330

320331
this.renderer=new vrMode(this);
321332
};

0 commit comments

Comments
 (0)