Skip to content
Snippets Groups Projects
Commit a0545031 authored by Greg Fodor's avatar Greg Fodor
Browse files

Stubbed out gear and daydream entry buttons

parent b81291f2
No related branches found
No related tags found
No related merge requests found
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { VR_DEVICE_AVAILABILITY } from "../utils/vr-caps-detect.js";
const ENTRY_STEPS = { const ENTRY_STEPS = {
start: "start", start: "start",
...@@ -18,11 +19,7 @@ async function hasGrantedMicPermissions() { ...@@ -18,11 +19,7 @@ async function hasGrantedMicPermissions() {
} }
function stopAllTracks(mediaStream) { function stopAllTracks(mediaStream) {
for (const track of mediaStream.getAudioTracks()) { for (const track of mediaStream.tracks) {
track.stop();
}
for (const track of mediaStream.getVideoTracks()) {
track.stop(); track.stop();
} }
} }
...@@ -60,6 +57,30 @@ async function getMediaStream(shareScreen, ...desiredMicRegexes) { ...@@ -60,6 +57,30 @@ async function getMediaStream(shareScreen, ...desiredMicRegexes) {
return mediaStream; return mediaStream;
} }
const TwoDEntryButton = (props) => (
<button {...props}>
Enter on this Screen
</button>
);
const GenericEntryButton = (props) => (
<button {...props}>
Enter in VR
</button>
);
const GearVREntryButton = (props) => (
<button {...props}>
Enter on GearVR
</button>
);
const DaydreamEntryButton = (props) => (
<button {...props}>
Enter on Daydream
</button>
);
class UIRoot extends Component { class UIRoot extends Component {
static propTypes = { static propTypes = {
enterScene: PropTypes.func, enterScene: PropTypes.func,
...@@ -94,6 +115,14 @@ class UIRoot extends Component { ...@@ -94,6 +115,14 @@ class UIRoot extends Component {
await this.performDirectEntryFlow(true); await this.performDirectEntryFlow(true);
} }
enterGearVR = async () => {
console.log("gear");
}
enterDaydream = async () => {
console.log("daydream");
}
getMediaStreamAndEnterScene = async (...desiredMicRegexes) => { getMediaStreamAndEnterScene = async (...desiredMicRegexes) => {
const preStreamAcquisitionTime = new Date(); const preStreamAcquisitionTime = new Date();
const mediaStream = await getMediaStream(this.state.shareScreen, ...desiredMicRegexes); const mediaStream = await getMediaStream(this.state.shareScreen, ...desiredMicRegexes);
...@@ -124,12 +153,10 @@ class UIRoot extends Component { ...@@ -124,12 +153,10 @@ class UIRoot extends Component {
const entryPanel = this.state.entryStep === ENTRY_STEPS.start const entryPanel = this.state.entryStep === ENTRY_STEPS.start
? ( ? (
<div> <div>
<button onClick={this.enter2D}> <TwoDEntryButton onClick={this.enter2D}/>
Enter on this Screen { this.props.availableVREntryTypes.generic !== VR_DEVICE_AVAILABILITY.no && <GenericEntryButton onClick={this.enterVR}/> }
</button> { this.props.availableVREntryTypes.gearvr !== VR_DEVICE_AVAILABILITY.no && <GearVREntryButton onClick={this.enterGearVR}/> }
<button onClick={this.enterVR}> { this.props.availableVREntryTypes.daydream !== VR_DEVICE_AVAILABILITY.no && <DaydreamEntryButton onClick={this.enterDaydream}/> }
Enter in VR
</button>
</div> </div>
) : null; ) : null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment