Skip to content

Open Web Browser to vid2scene Upload Page from App #9

Description

@samuelm2

🎯 Problem Statement

After capturing data on Quest, users need to manually:

  1. Exit the app
  2. Open the Quest browser
  3. Navigate to vid2scene.com/upload/quest
  4. Upload their exported ZIP file

This breaks the workflow and requires multiple steps outside the app.


💡 Proposed Solution

Add a simple button at the top right of the Recording Menu that opens the Quest browser to vid2scene.

Button placement:

  • Top right corner of Recording Menu panel
  • Small button/icon with text like "Open vid2scene upload page" or "Upload to vid2scene"

Expected behavior:

  1. User clicks button at top right of menu
  2. Quest browser opens automatically
  3. Browser navigates to https://vid2scene.com/upload/quest
  4. User can immediately drag & drop their exported ZIP

🔨 Implementation

Unity Code

Add URL opening capability:

// NEW FILE: Assets/RealityLog/Scripts/Runtime/UI/WebBrowserLauncher.cs
using UnityEngine;

namespace RealityLog.UI
{
    /// <summary>
    /// Launches external web browser on Quest
    /// </summary>
    public class WebBrowserLauncher : MonoBehaviour
    {
        private const string VID2SCENE_UPLOAD_URL = "https://vid2scene.com/upload/quest";
        
        /// <summary>
        /// Opens the vid2scene upload page in Quest browser
        /// </summary>
        public void OpenVid2SceneUpload()
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            try
            {
                using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
                using (AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
                using (AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent"))
                using (AndroidJavaClass uri = new AndroidJavaClass("android.net.Uri"))
                {
                    AndroidJavaObject parsedUri = uri.CallStatic<AndroidJavaObject>("parse", VID2SCENE_UPLOAD_URL);
                    intent.Call<AndroidJavaObject>("setAction", "android.intent.action.VIEW");
                    intent.Call<AndroidJavaObject>("setData", parsedUri);
                    
                    currentActivity.Call("startActivity", intent);
                    
                    Debug.Log($"[WebBrowserLauncher] Opened browser to: {VID2SCENE_UPLOAD_URL}");
                }
            }
            catch (System.Exception e)
            {
                Debug.LogError($"[WebBrowserLauncher] Failed to open browser: {e.Message}");
            }
#else
            // Editor: Open in default browser
            Application.OpenURL(VID2SCENE_UPLOAD_URL);
#endif
        }
        
        /// <summary>
        /// Opens a custom URL in the browser
        /// </summary>
        public void OpenURL(string url)
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            try
            {
                using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
                using (AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
                using (AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent"))
                using (AndroidJavaClass uri = new AndroidJavaClass("android.net.Uri"))
                {
                    AndroidJavaObject parsedUri = uri.CallStatic<AndroidJavaObject>("parse", url);
                    intent.Call<AndroidJavaObject>("setAction", "android.intent.action.VIEW");
                    intent.Call<AndroidJavaObject>("setData", parsedUri);
                    
                    currentActivity.Call("startActivity", intent);
                    
                    Debug.Log($"[WebBrowserLauncher] Opened browser to: {url}");
                }
            }
            catch (System.Exception e)
            {
                Debug.LogError($"[WebBrowserLauncher] Failed to open browser: {e.Message}");
            }
#else
            Application.OpenURL(url);
#endif
        }
    }
}

UI Integration

Add button to top right of Recording Menu panel:

// In your existing Recording Menu UI script
[SerializeField] private WebBrowserLauncher browserLauncher;
[SerializeField] private Button vid2sceneButton; // Place at top right of panel

private void Start()
{
    // ... existing code ...
    
    // Simple click handler
    vid2sceneButton?.onClick.AddListener(() => {
        browserLauncher?.OpenVid2SceneUpload();
    });
}

Unity UI Setup:

  • Add WebBrowserLauncher component to scene
  • Add Button to top right of Recording Menu panel
  • Button text: "Open vid2scene upload page" or "vid2scene ↗"
  • Wire up button reference in Inspector

✅ Acceptance Criteria

  • Button added to top right of Recording Menu panel
  • Button text: "Open vid2scene upload page" or similar
  • Clicking button opens Quest browser
  • Browser navigates to https://vid2scene.com/upload/quest
  • Works on Quest 3
  • Gracefully handles errors (logs warning if browser fails to open)
  • Button has subtle/secondary styling (not a primary action)

🎨 UI Design

Simple button at top right of menu:

┌─────────────────────────────────────────┐
│  Recording Menu    [Open vid2scene ↗] ← NEW
├─────────────────────────────────────────┤
│                                         │
│  [Recording List]                       │
│                                         │
│                                         │
│                                         │
└─────────────────────────────────────────┘

Button style options:

  • Small text button: "Open vid2scene ↗"
  • Icon button with tooltip
  • Secondary/subtle styling (not main action)
  • External link icon (↗) to indicate opens browser

🧪 Testing

  1. Basic Functionality:

    • Click "Upload to vid2scene" button
    • Verify Quest browser opens
    • Verify URL is correct: https://vid2scene.com/upload/quest
  2. Browser State:

    • App should continue running in background
    • User can switch back to app
    • Multiple clicks should open multiple tabs (or reuse existing)
  3. Error Handling:

    • Test with no browser available (edge case)
    • Verify error is logged but doesn't crash app
  4. User Flow:

    • Export data → Click upload button → Browser opens
    • User can immediately drag & drop ZIP file to upload

🔗 Related Files

  • Recording Menu UX (Assets/RealityLog/Scripts/Runtime/UI/RecordingMenuController.cs and similar)
  • See the Recording Menu in the Unity Scene

📚 Additional Notes

Android Permissions:

  • No additional permissions needed (INTERNET is standard)
  • Uses standard Android intents

Quest Browser:

  • Meta Quest Browser is the default browser
  • Should handle any standard HTTP/HTTPS URL
  • Browser continues running after user switches back to app

Cloud Service Integration:

  • This is a convenience feature for vid2scene users
  • Could be extended to support other services:
    • Polycam upload
    • Custom cloud storage / Drive Upload
    • Email sharing

Implementation Time: ~30 minutes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions