Skip to content

Overview

  • File: lib/views/call_page.dart

The call_page.dart file implements the video call interface for the HVC XR application. It provides a comprehensive video conferencing experience with features like camera controls, audio management, chat functionality, and device-specific optimizations for RealWear devices.

Class Structure

dart
class CallPage extends StatefulWidget {
  static const String routeName = '/MeetingPage';

  final CallDetails callDetails;
  final bool isEventOwner;
  final bool isGuest;
  final bool isRapidConnect;
}

class _CallPageState extends State<CallPage> with WidgetsBindingObserver {
  // State implementation
}

Dependencies

  • dart:async - For asynchronous operations
  • dart:core - Core Dart functionality
  • dart:io - Platform-specific functionality
  • flutter/material.dart - Flutter UI components
  • get/get.dart - State management
  • hippo_web_rtc - WebRTC implementation
  • onesignal_flutter - Push notifications
  • uuid - Unique identifier generation
  • wakelock - Screen wake lock management

Key Components

State Variables

  • _localVideoRenderer - Renders local video stream
  • _remoteVideoRenderer - Renders remote video stream
  • _sessionId - Unique session identifier
  • _sessionDate - Session timestamp
  • availableList - List of available participants
  • chatOptions - Chat configuration options
  • imageUrl - URL for shared images
  • timeString - Call duration display

Controllers

  • pexipController - Manages Pexip video call functionality
  • mediaController - Handles media operations
  • meetingsController - Manages meeting state
  • messagesController - Handles chat messages
  • contactsController - Manages contact information
  • eventsController - Handles event-related operations
  • realTimeController - Manages real-time communication
  • authController - Handles authentication
  • digilensController - Manages DigiLens-specific features

Core Functionality

Video Call Management

dart
void _handleStartCall() async {
  await pexipController.start();
  realTimeController.sendState('call');
}

Camera Controls

  • Camera switching
  • Zoom control
  • Torch control
  • Laser pointer (device-specific)
  • Exposure adjustment

Audio Management

dart
Future<void> _audioAndSpeaker(bool onOrOff) async {
  await pexipController.setAudioOnOrOff(onOrOff);
  await _changeSpeakerState(onOrOff);
}

Device Information

dart
Future<void> updateDeviceInfoOnServer() async {
  final deviceInfo = HeadsetDeviceInfo(
    contactName: user.name,
    deviceName: deviceId,
    deviceType: deviceType,
    // ... other device information
  );
  await realTimeController.callDeviceStatus(deviceInfo);
}

Remote Control Handling

dart
void _handleRemoteControl(RemoteControlResponse remoteControl) async {
  // Handles various remote control actions:
  // - Exposure adjustment
  // - Photo capture
  // - Zoom control
  // - Torch control
  // - Laser control
  // - Camera switching
}

UI Components

Main Layout

  • Video display area
  • Control buttons
  • Participant list
  • Chat window
  • Device controls

Control Buttons

  • Audio mute/unmute
  • Video on/off
  • Camera switch
  • Zoom control
  • Remote control
  • View switch
  • Participant view
  • Chat toggle
  • More options

Voice Commands

dart
void registerCallCommands() {
  voiceCommandMap['participants'] = () => handleParticipantsAndMainView();
  voiceCommandMap['mainView'] = () => handleParticipantsAndMainView();
  voiceCommandMap['zoom'] = () => handleZoom();
  // ... other voice commands
}

Device-Specific Features

  • Optimized camera controls
  • Enhanced zoom functionality
  • Improved audio handling
  • Better performance

DigiLens Support

  • Specialized UI adaptations
  • Custom control layouts
  • Optimized performance

State Management

  • Uses GetX for reactive state management
  • Manages call state, participant list, and UI controls
  • Handles device-specific state changes

Error Handling

dart
void handleException(e) {
  logInfo('Error: $e');
  // Error handling implementation
}

Dependencies

  • get - State management
  • hippo_web_rtc - WebRTC implementation
  • onesignal_flutter - Push notifications
  • permission_handler - Permission management
  • uuid - ID generation
  • wakelock - Screen wake lock

Styling

  • Follow application theme
  • Use consistent button styles
  • Implement responsive layouts
  • Handle different screen sizes
  • Support dark/light modes

Released under the MIT License.