Skip to content

Commit

Permalink
Merge pull request videojs#3 from kevleyski/main
Browse files Browse the repository at this point in the history
[KJSL] Swap webvr ro webxr polyfill packages
  • Loading branch information
kevleyski authored Dec 7, 2022
2 parents eecdbba + d6821ab commit 842abed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require('babel-polyfill');

import 'babel-polyfill';
import {version as VERSION} from '../package.json';
import window from 'global/window';
Expand Down Expand Up @@ -709,14 +707,16 @@ void main() {
// ShowEnterVRButton
document.body.appendChild(VRButton.createButton(this.renderer));

this.renderer.setAnimationLoop(this.render.bind(this));

if (displays.length > 0) {
this.log('Displays found', displays);
this.vrDisplay = displays[0];

// Native WebVR Head Mounted Displays (HMDs) like the HTC Vive
// also need the cardboard button to enter fully immersive mode
// so, we want to add the button if we're not polyfilled.
if (!this.vrDisplay.isPolyfilled) {
if (1 || !this.vrDisplay.isPolyfilled) {
this.log('Real HMD found using VRControls', this.vrDisplay);
this.addCardboardButton_();

Expand Down Expand Up @@ -778,6 +778,10 @@ void main() {
this.trigger('initialized');
}

render() {
this.renderer.render(this.scene, this.camera);
}

addCardboardButton_() {
if (!this.player_.controlBar.getChild('CardboardButton')) {
this.player_.controlBar.addChild('CardboardButton', {});
Expand Down
8 changes: 4 additions & 4 deletions vendor/three/VRButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class VRButton {

button.onmouseleave = function () {

button.style.opacity = '0.5';
button.style.opacity = '0.8';

};

Expand All @@ -62,7 +62,7 @@ class VRButton {
// ('local' is always available for immersive sessions and doesn't need to
// be requested separately.)

const sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor', 'hand-tracking', 'layers' ] };
const sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor', 'hand-tracking' ] };
navigator.xr.requestSession( 'immersive-vr', sessionInit ).then( onSessionStarted );

} else {
Expand Down Expand Up @@ -111,15 +111,15 @@ class VRButton {
function stylizeElement( element ) {

element.style.position = 'absolute';
element.style.bottom = '20px';
element.style.top = '20px';
element.style.padding = '12px 6px';
element.style.border = '1px solid #fff';
element.style.borderRadius = '4px';
element.style.background = 'rgba(0,0,0,0.1)';
element.style.color = '#fff';
element.style.font = 'normal 13px sans-serif';
element.style.textAlign = 'center';
element.style.opacity = '0.5';
element.style.opacity = '0.8';
element.style.outline = 'none';
element.style.zIndex = '999';

Expand Down

0 comments on commit 842abed

Please sign in to comment.