### Build and Install FadCam Source: https://github.com/anonfaded/fadcam/wiki/Development/Setup-Media3-Patched Execute this command to build and install the FadCam application after setting up the patched Media3 library. Verify Media3 path configuration if build fails. ```bash ./gradlew assembleDefaultDebug installDefaultDebug ``` -------------------------------- ### Usage Examples Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/assets/avatar/README.md Practical examples demonstrating how to use the avatar's methods. ```APIDOC ## Examples ### Toggling Visibility ```javascript // Toggle visibility between shown and hidden avatar.toggle(); // Force show the avatar avatar.toggle(true); // Force hide the avatar avatar.toggle(false); ``` ### Repositioning ```javascript // Move avatar to the top-left corner avatar.setPosition('top-left'); ``` ### Enabling Debug Mode ```javascript // Show tracking overlay avatar.enableDebugMode(); ``` ### Destroying the Avatar ```javascript // Remove avatar from the DOM and clean up resources avatar.destroy(); ``` ``` -------------------------------- ### API: Methods Examples Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/assets/avatar/README.md Demonstrates common avatar component methods for controlling visibility, position, debugging, and cleanup. ```javascript // Toggle visibility avatar.toggle(); // Switch on/off avatar.toggle(true); // Force show avatar.toggle(false); // Force hide // Reposition avatar.setPosition('top-left'); // Debug tracking info avatar.enableDebugMode(); // Cleanup (removes from DOM) avatar.destroy(); ``` -------------------------------- ### Quick Setup: HTML Integration Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/assets/avatar/README.md Integrate the avatar component into your HTML by adding the CSS and JavaScript files and initializing the Avatar class. ```html ``` -------------------------------- ### GET /init.mp4 Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Provides the CMAF init segment for video playback. ```APIDOC ## GET /init.mp4 ### Description Provides the CMAF init segment for video playback. ### Method GET ### Endpoint /init.mp4 ``` -------------------------------- ### Initialize Dashboard ViewModel Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Initializes the main dashboard view model, fetching the initial status and emitting an event. It waits for recording to start before auto-loading the stream. ```javascript await dashboardViewModel.initialize(); ``` -------------------------------- ### AppLock Library Installation (Groovy) Source: https://github.com/anonfaded/fadcam/blob/master/app/libs/AppLockLibrary/readme.md Add the AppLock library to your project's dependencies by including the mavenCentral repository and the library artifact. ```groovy repositories { maveCentral() } dependencies { compile('com.guardanis:applock:3.0.2') } ``` -------------------------------- ### GET /audio/volume Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Retrieves the current device volume level and its percentage. ```APIDOC ## GET /audio/volume ### Description Retrieves the current device volume level and its percentage. ### Method GET ### Endpoint /audio/volume ``` -------------------------------- ### GET /status Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Retrieves the current status of the server, including metrics, battery level, network information, torch status, volume, recording mode, and stream quality. ```APIDOC ## GET /status ### Description Retrieves the current status of the server, including metrics, battery level, network information, torch status, volume, recording mode, and stream quality. ### Method GET ### Endpoint /status ``` -------------------------------- ### Initialize Avatar and Log Status Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/assets/avatar/demo.html Initializes the Avatar component and logs its status and default position to the console. Provides a starting point for interacting with the avatar. ```javascript // Global avatar instance for demo controls let avatar; // Wait for DOM to be ready document.addEventListener('DOMContentLoaded', function() { avatar = new Avatar(); console.log('â Avatar initialized successfully!'); console.log('đ Position: bottom-right (default)'); console.log('đ¯ Try moving your mouse around!'); }); ``` -------------------------------- ### Initialization Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/assets/avatar/README.md How to create and initialize an instance of the Avatar component. ```APIDOC ## Initialization Creates and shows the avatar component. ### Method Signature ```javascript new Avatar() ``` ### Example ```javascript const avatar = new Avatar(); ``` ``` -------------------------------- ### Advanced Usage: Conditional Loading Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/assets/avatar/README.md Conditionally load the Avatar component based on screen width, for example, to only display it on larger screens. ```javascript if (window.innerWidth > 768) new Avatar(); // Desktop only ``` -------------------------------- ### Show Lock Creation Dialog (Java) Source: https://github.com/anonfaded/fadcam/blob/master/app/libs/AppLockLibrary/readme.md Launch a dialog for creating a new PIN lock. This dialog provides callbacks for cancellation and successful lock creation. ```java new LockCreationDialogBuilder(this) .onCanceled(() -> { showIndicatorMessage("You canceled..."); }) .onLockCreated(() -> { showIndicatorMessage("Lock created!"); }) .show() ``` -------------------------------- ### Initialize Sidebar and Video Element Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Initializes the sidebar state based on screen width and sets up the video element. It also includes logic to wait for configuration to load and renders zoom slider presets. ```javascript document.addEventListener('DOMContentLoaded', async () => { // Initialize sidebar state based on screen size const sidebar = document.getElementById('sidebar'); sidebarOpen = window.innerWidth > 1024; // true on desktop, false on mobile if (!sidebarOpen) { sidebar.classList.add('sidebar-hidden'); // On mobile, add hidden class } videoElement = document.getElementById('videoPlayer'); let attempts = 0; while (!CONFIG && attempts < 50) { await new Promise(resolve => setTimeout(resolve, 50)); attempts++; } if (!CONFIG) { console.error('\[DOMContentLoaded\] CONFIG failed to load'); return; } const zoomSlider = document.getElementById('zoomSlider'); if (zoomSlider) { zoomSlider.dataset.zoomMax = '10.0'; } renderZoomSliderPresets(); updateZoomSliderVisuals(1.0); dashboardViewModel = new DashboardViewModel(); // Track last activity time for auto-lock timeout let lastActivityTime = Date.now(); let previousAuthSessionsCleared = false; let previousAuthEnabled = null; // Listen for status updates before initializing eventBus.on('status-updated', (status) => { updateUI(status); // ===== AUTH STATE CHANGE DETECTION ===== // Check if auth was disabled on ``` -------------------------------- ### GET /live.m3u8 Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Provides the HLS stream playlist for video playback. This URL can be used in compatible media players like VLC. ```APIDOC ## GET /live.m3u8 ### Description Provides the HLS stream playlist for video playback. This URL can be used in compatible media players like VLC. ### Method GET ### Endpoint /live.m3u8 ``` -------------------------------- ### Initialize Authentication System Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Initializes the authentication system by checking the current auth status. If authentication is enabled and the user is not authenticated, it shows the lock screen. ```javascript async function initializeAuth() { try { const status = await authService.checkAuthStatus(); console.log('B[Auth] Initial check:', status); if (status.authEnabled && !status.authenticated) { showLockScreen(); } else if (status.authEnabled && status.authenticated) { console.log('B[Auth] Already authenticated, session valid'); } } catch (error) { console.error('B[Auth] Initialization failed:', error); } } ``` -------------------------------- ### Available Methods Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/assets/avatar/demo.html Reference for the methods available on the Avatar instance. ```APIDOC ## Available Methods ### Toggle Visibility Controls the visibility of the avatar. - `avatar.toggle()`: Toggles the avatar's visibility on or off. - `avatar.toggle(true)`: Explicitly shows the avatar. - `avatar.toggle(false)`: Explicitly hides the avatar. ### Change Position Sets the position of the avatar on the screen. - `avatar.setPosition('bottom-right')` - `avatar.setPosition('bottom-left')` - `avatar.setPosition('top-right')` - `avatar.setPosition('top-left')` ### Debug Mode Enables or disables debug information display. - `avatar.enableDebugMode()`: Shows tracking information for debugging purposes. ### Cleanup Removes the avatar and its associated event listeners from the DOM. - `avatar.destroy()`: Cleans up and removes the avatar instance. ``` -------------------------------- ### Get Zoom Marker CSS Position Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Calculates the CSS 'left' property for a zoom slider thumb, accounting for its width and the slider's percentage. ```javascript function getZoomMarkerLeftCss(pct) { const thumbWidthPx = 16; const centerOffsetPx = (thumbWidthPx / 2) - ((pct / 100) * thumbWidthPx); return 'calc(' + pct.toFixed(1) + '% + ' + centerOffsetPx.toFixed(1) + 'px)'; } ``` -------------------------------- ### Open Lock Creation Activity (Java) Source: https://github.com/anonfaded/fadcam/blob/master/app/libs/AppLockLibrary/readme.md Launch the activity for creating a PIN lock. Ensure to handle the result using `LockingHelper.REQUEST_CODE_CREATE_LOCK`. ```java Intent intent = new Intent(activity, LockCreationActivity.class); startActivityForResult(intent, LockingHelper.REQUEST_CODE_CREATE_LOCK); ``` -------------------------------- ### Handle E2E Stream Ready Event Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Sets up a listener for the 'e2e-stream-ready' event to handle E2E key decryption and reload the stream. This should be set up only once. ```javascript if (!window.__e2eStreamReadyHandler) { window.__e2eStreamReadyHandler = function() { console.log('\[Stream\] đ E2E key unlocked â reloading stream'); if (hlsService) { hlsService.reloadStream(); } updateE2EFooterVisibility(); }; window.addEventListener('e2e-stream-ready', window.__e2eStreamReadyHandler); } ``` -------------------------------- ### Start Schedule Countdown Interval Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Initiates a recurring interval timer to update the schedule countdown every second. If the scheduled time is reached, it triggers the alarm and clears the interval. ```javascript function startScheduleCountdown() { if (scheduleCountdownInterval) { clearInterval(scheduleCountdownInterval); } scheduleCountdownInterval = setInterval(() => { if (!alarmScheduled) { clearInterval(scheduleCountdownInterval); return; } const now = new Date().getTime(); const remaining = alarmScheduled.scheduledTime - now; if (remaining <= 0) { // Trigger scheduled alarm clearInterval(scheduleCountdownInterval); triggerScheduledAlarm(); } else { updateScheduleDisplay(); } }, 1000); } ``` -------------------------------- ### Faditor Mini User Flow Source: https://github.com/anonfaded/fadcam/wiki/Faditor-mini-ARCHITECTURE Illustrates the user flow through the Faditor Mini application, from the initial tab entry point to the full-screen editor and back. ```text User Flow: FaditorMiniFragment (tab) â [video picker] FaditorEditorActivity (full-screen) ââ FaditorPlayerManager (ExoPlayer playback) ââ TimelineView (custom timeline UI) ââ ProjectStorage (JSON persistence) ââ ExportManager (Media3 Transformer) â [export done] FaditorMiniFragment (back to tab with exported file) ``` -------------------------------- ### Quick Integration Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/assets/avatar/demo.html Steps to quickly integrate the Interactive Avatar into your website. ```APIDOC ## Quick Integration Add these 3 simple steps to any website: ### Step 1: Include CSS ```html ``` ### Step 2: Include JavaScript ```html ``` ### Step 3: Initialize (after DOM loads) ```html ``` ``` -------------------------------- ### Toggle Recording State Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Toggles the recording state of the camera. Handles both starting and stopping recording, including cases where the recording is paused. Displays an 'Executing...' overlay during the operation. ```javascript async function toggleRecording() { console.log('\[Recording\] Toggle requested'); const oldState = currentStatus?.isRecording; const isPaused = currentStatus?.isPaused; // If paused, toggle should stop recording (not resume â pause btn handles resume) const newState = isPaused ? false : !oldState; // Show "Executing..." overlay on recording card executingState.start('isRecording', newState, '.recording-card'); try { // Call the API await dashboardViewModel.toggleRecording(); // In cloud mode, command is sent // executingState will check and update when status poll returns matching value } catch (error) { console.error('\[Recording\] Failed to toggle:', error); executingState.stop('isRecording'); showToast('Failed to toggle recording'); } } ``` -------------------------------- ### Display Uptime Modal Content Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/index.html Populates the 'uptimeModal' with detailed uptime information, including formatted uptime, total seconds, and session start date/time. It retrieves data from the 'currentStatus' object. ```javascript function showUptimeModal() { if (!currentStatus) return; const uptimeDetails = currentStatus.uptimeDetails || {}; const content = `
Note: Bitrate and FPS are locked per preset during streaming. Resolution is always set from Recording Settings. Restart recording to apply changes. ``` -------------------------------- ### Load HTML Stream Interface in Java Source: https://github.com/anonfaded/fadcam/blob/master/app/src/main/assets/web/README.md Load the index.html file as an InputStream within a Java application. Changes to index.html require rebuilding the APK. ```java InputStream htmlStream = getClass().getResourceAsStream("/com/fadcam/streaming/web/index.html"); ```