### Start Example App Packager Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Starts the Metro bundler for the example application. This is required to run the example app on a simulator or device. ```bash yarn example start ``` -------------------------------- ### Run Example App on iOS Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Builds and runs the example application on an iOS simulator or device. Ensure Xcode is installed and configured. ```bash yarn example ios ``` -------------------------------- ### Setup iOS Project for New Architecture Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Configures the iOS project for the new architecture by installing pods with the RCT_NEW_ARCH_ENABLED flag and then running the app. ```bash RCT_NEW_ARCH_ENABLED=1 yarn pod-install example/ios yarn example ios ``` -------------------------------- ### Install GCDWebServer with Carthage Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Install the GCDWebServer library using Carthage. Ensure you are using a version that supports Carthage, starting from 3.2.5. ```Shell github "swisspol/GCDWebServer" ~> 3.2.5 $ carthage update # Then add the generated frameworks to your Xcode project. ``` -------------------------------- ### Run Example App on Android Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Builds and runs the example application on an Android device or emulator. Ensure an Android emulator is running or a device is connected. ```bash yarn example android ``` -------------------------------- ### Run Android Example with New Architecture Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Executes the example app on Android, enabling the new architecture. This requires setting the ORG_GRADLE_PROJECT_newArchEnabled environment variable. ```bash ORG_GRADLE_PROJECT_newArchEnabled=true yarn example android ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Installs all necessary dependencies for the monorepo using Yarn workspaces. This command should be run in the root directory to set up the project. ```bash yarn ``` -------------------------------- ### Start Metro Bundler Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/example/README.md Starts the Metro JavaScript bundler, which is essential for running React Native applications. This command should be executed from the root of your project directory. ```bash # using npm npm start # OR using Yarn yarn start ``` -------------------------------- ### Install react-native-cache-video with npm Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/README.md Installs the react-native-cache-video library along with its peer dependencies, react-native-blob-util and react-native-url-polyfill, using npm. ```sh npm install react-native-blob-util react-native-url-polyfill react-native-cache-video ``` -------------------------------- ### Install GCDWebServer with CocoaPods Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Install the GCDWebServer library and its extensions using CocoaPods. Specify the core library or extensions like WebUploader or WebDAV. ```Shell pod "GCDWebServer", ">= 3.0" pod "GCDWebServer/WebUploader", ">= 3.0" pod "GCDWebServer/WebDAV", ">= 3.0" $ pod install ``` -------------------------------- ### Install react-native-cache-video with yarn Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/README.md Installs the react-native-cache-video library along with its peer dependencies, react-native-blob-util and react-native-url-polyfill, using yarn. ```sh yarn add react-native-blob-util react-native-url-polyfill react-native-cache-video ``` -------------------------------- ### Implement HTTP Redirects with GCDWebServer Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Demonstrates how to add a handler for GET requests to redirect to another path. This example uses GCDWebServerResponse to automatically set the HTTP status code and 'Location' header for the redirect. ```Objective-C [self addHandlerForMethod:@"GET" path:@"/" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { return [GCDWebServerResponse responseWithRedirect:[NSURL URLWithString:@"index.html" relativeToURL:request.URL] permanent:NO]; }]; ``` -------------------------------- ### GCDWebServer iOS App Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Implements a custom HTTP server using GCDWebServer within an iOS AppDelegate. It handles GET requests and returns a "Hello World" HTML page, starting the server on port 8080. ```objective-c #import "GCDWebServer.h" #import "GCDWebServerDataResponse.h" @interface AppDelegate : NSObject { GCDWebServer* _webServer; } @end @implementation AppDelegate - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { // Create server _webServer = [[GCDWebServer alloc] init]; // Add a handler to respond to GET requests on any URL [_webServer addDefaultHandlerForMethod:@"GET" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { return [GCDWebServerDataResponse responseWithHTML:@"

Hello World

"]; }]; // Start server on port 8080 [_webServer startWithPort:8080 bonjourName:nil]; NSLog(@"Visit %@ in your web browser", _webServer.serverURL); return YES; } @end ``` -------------------------------- ### GCDWebServer Static File Serving Example (macOS CLI) Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Demonstrates how to use GCDWebServer as a command-line tool on macOS to serve a directory as a static website. It configures caching and range requests. ```objectivec #import "GCDWebServer.h" int main(int argc, const char* argv[]) { @autoreleasepool { GCDWebServer* webServer = [[GCDWebServer alloc] init]; [webServer addGETHandlerForBasePath:@"/" directoryPath:NSHomeDirectory() indexFilename:nil cacheAge:3600 allowRangeRequests:YES]; [webServer runWithPort:8080]; } return 0; } ``` -------------------------------- ### Start React Native Application Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/example/README.md Launches your React Native application on an Android emulator/device or an iOS simulator/device. This command is run in a separate terminal window while the Metro bundler is active. ```bash ### For Android # using npm npm run android # OR using Yarn yarn android ### For iOS # using npm npm run ios # OR using Yarn yarn ios ``` -------------------------------- ### GCDWebDAVServer Initialization in AppDelegate Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Initializes and starts a GCDWebDAVServer instance within the AppDelegate of an iOS application. It serves files from the application's Documents directory. ```objectivec @interface AppDelegate : NSObject { GCDWebDAVServer* _davServer; } @end @implementation AppDelegate - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]; _davServer = [[GCDWebDAVServer alloc] initWithUploadDirectory:documentsPath]; [_davServer start]; NSLog(@"Visit %@ in your WebDAV client", _davServer.serverURL); return YES; } @end ``` -------------------------------- ### GCDWebServer macOS Command Line Tool Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Implements a custom HTTP server using GCDWebServer on macOS. It handles GET requests and returns a "Hello World" HTML page. The server runs until SIGINT (Ctrl-C) or SIGTERM is received. ```objective-c #import "GCDWebServer.h" #import "GCDWebServerDataResponse.h" int main(int argc, const char* argv[]) { @autoreleasepool { // Create server GCDWebServer* webServer = [[GCDWebServer alloc] init]; // Add a handler to respond to GET requests on any URL [webServer addDefaultHandlerForMethod:@"GET" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { return [GCDWebServerDataResponse responseWithHTML:@"

Hello World

"]; }]; // Use convenience method that runs server on port 8080 // until SIGINT (Ctrl-C in Terminal) or SIGTERM is received [webServer runWithPort:8080 bonjourName:nil]; NSLog(@"Visit %@ in your web browser", webServer.serverURL); } return 0; } ``` -------------------------------- ### GCDWebServer: Add Asynchronous GET Handler with Callback (Objective-C) Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Shows how to add a GET request handler that processes requests asynchronously. The handler returns immediately and uses a completion block to provide the response after an operation (simulated with dispatch_after). ```objective-c [webServer addDefaultHandlerForMethod:@"GET" requestClass:[GCDWebServerRequest class] asyncProcessBlock:^(GCDWebServerRequest* request, GCDWebServerCompletionBlock completionBlock) { // Do some async operation like network access or file I/O (simulated here using dispatch_after()) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ GCDWebServerDataResponse* response = [GCDWebServerDataResponse responseWithHTML:@"

Hello World

"]; completionBlock(response); }); }]; ``` -------------------------------- ### GCDWebServer: Add Synchronous GET Handler (Objective-C) Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Demonstrates adding a default handler for GET requests that generates an HTML response synchronously. The handler blocks until the response is ready, suitable for simple, quick operations. ```objective-c [webServer addDefaultHandlerForMethod:@"GET" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { GCDWebServerDataResponse* response = [GCDWebServerDataResponse responseWithHTML:@"

Hello World

"]; return response; }]; ``` -------------------------------- ### Serve HTML Form with GCDWebServer Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Shows how to add a GET handler to serve an HTML form. This handler uses GCDWebServerRequest and returns a GCDWebServerDataResponse containing the HTML structure for a simple form. ```Objective-C [webServer addHandlerForMethod:@"GET" path:@"/" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { NSString* html = @"
Value:
"; return [GCDWebServerDataResponse responseWithHTML:html]; }]; ``` -------------------------------- ### GCDWebServer: Add Streamed GET Handler with Async Content (Objective-C) Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Illustrates adding a GET request handler that returns a streamed HTTP response. The content is generated asynchronously via a block, allowing for chunked data delivery, suitable for large files or dynamic content streams. ```objective-c [webServer addDefaultHandlerForMethod:@"GET" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { NSMutableArray* contents = [NSMutableArray arrayWithObjects:@"

\n", @"Hello World!\n", @"

\n", nil]; // Fake data source we are reading from GCDWebServerStreamedResponse* response = [GCDWebServerStreamedResponse responseWithContentType:@"text/html" asyncStreamBlock:^(GCDWebServerBodyReaderCompletionBlock completionBlock) { // Simulate a delay reading from the fake data source dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSString* string = contents.firstObject; if (string) { [contents removeObjectAtIndex:0]; completionBlock([string dataUsingEncoding:NSUTF8StringEncoding], nil); // Generate the 2nd part of the stream data } else { completionBlock([NSData data], nil); // Must pass an empty NSData to signal the end of the stream } }); }]; return response; }]; ``` -------------------------------- ### Video Caching with Provider and Policies Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/README.md Shows how to integrate react-native-cache-video with a CacheManagerProvider to manage cache memory using custom policies like FreePolicy or LFUPolicy. This setup allows for more control over cache behavior. ```javascript import React from 'react'; import { CacheManagerProvider, FreePolicy, LFUPolicy } from 'react-native-cache-video'; // provide your component access Cache context const App = () => { // Instantiate your chosen policy const freePolicy = React.useRef(new FreePolicy()); // const lfuPolicy = React.useRef(new LFUPolicy()); // Example for LFU policy return ( {/* your component tree */} {/* e.g., */} ); }; export default App; ``` -------------------------------- ### Publish to npm Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Uses release-it to automate the process of publishing new versions of the library to the npm registry. This includes version bumping, tagging, and creating releases. ```bash yarn release ``` -------------------------------- ### Run Unit Tests Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Executes the project's unit tests using Jest to verify the functionality of individual code components. ```bash yarn test ``` -------------------------------- ### Serve HTML Templates and Static Files with GCDWebServer (Objective-C) Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md This snippet demonstrates how to configure GCDWebServer to serve static assets from a directory and handle dynamic HTML content using a simple templating system. It includes setting up a default handler for static files and an override handler for HTML files that substitutes variables within the template. A redirection handler for the root URL is also included. ```objectivec NSString* websitePath = [[NSBundle mainBundle] pathForResource:@"Website" ofType:nil]; // Add a default handler to serve static files (i.e. anything other than HTML files) [self addGETHandlerForBasePath:@"/" directoryPath:websitePath indexFilename:nil cacheAge:3600 allowRangeRequests:YES]; // Add an override handler for all requests to "*.html" URLs to do the special HTML templatization [self addHandlerForMethod:@"GET" pathRegex:@"/.*\.html" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { NSDictionary* variables = [NSDictionary dictionaryWithObjectsAndKeys:@"value", @"variable", nil]; return [GCDWebServerDataResponse responseWithHTMLTemplate:[websitePath stringByAppendingPathComponent:request.path] variables:variables]; }]; // Add an override handler to redirect "/" URL to "/index.html" [self addHandlerForMethod:@"GET" path:@"/" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { return [GCDWebServerResponse responseWithRedirect:[NSURL URLWithString:@"index.html" relativeToURL:request.URL] permanent:NO]; ]; ``` -------------------------------- ### GCDWebServer Core Classes Overview Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Details the four core classes that constitute the GCDWebServer architecture: GCDWebServer for managing connections and handlers, GCDWebServerConnection for handling individual connections, GCDWebServerRequest for parsing requests, and GCDWebServerResponse for generating responses. ```APIDOC GCDWebServer Architecture: * GCDWebServer: - Manages the socket for listening to new HTTP connections. - Holds the list of handlers used by the server. * GCDWebServerConnection: - Instantiated by GCDWebServer for each new HTTP connection. - Remains alive until the connection is closed. - Designed for subclassing to override hooks; not for direct use. * GCDWebServerRequest: - Created by GCDWebServerConnection after receiving HTTP headers. - Wraps the request and handles the HTTP body. - Has subclasses for common cases like in-memory or file-streamed bodies. * GCDWebServerResponse: - Created by request handlers. - Wraps response HTTP headers and optional body. - Has subclasses for common cases like in-memory HTML or file streaming. ``` -------------------------------- ### GCDWebServer Handler Implementation Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Explains how to implement handlers for GCDWebServer using GCD blocks. It covers the GCDWebServerMatchBlock for deciding whether to handle a request and GCDWebServerProcessBlock/GCDWebServerAsyncProcessBlock for generating responses, emphasizing thread-safety. ```APIDOC Implementing Handlers: Handlers are implemented using GCD blocks and are executed on arbitrary threads, requiring attention to thread-safety. Handlers require two GCD blocks: 1. GCDWebServerMatchBlock: - Called for every handler when a web request starts. - Receives request info (HTTP method, URL, headers). - Must return a GCDWebServerRequest instance if it handles the request, otherwise nil. 2. GCDWebServerProcessBlock or GCDWebServerAsyncProcessBlock: - Called after the request is fully received, with the GCDWebServerRequest instance. - GCDWebServerProcessBlock: Returns a GCDWebServerResponse synchronously. - GCDWebServerAsyncProcessBlock: Returns a GCDWebServerResponse asynchronously. - Returns nil on error, resulting in a 500 HTTP status. - Recommended to return GCDWebServerErrorResponse for detailed errors. Many add handler methods provide a built-in GCDWebServerMatchBlock (e.g., for path matching), requiring only the process block. ``` -------------------------------- ### GCDWebServer macOS Swift CLI Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Implements a custom HTTP server using GCDWebServer in Swift for macOS command-line tools. This snippet includes the main server logic and a bridging header for Objective-C compatibility. ```swift import Foundation import GCDWebServer func initWebServer() { let webServer = GCDWebServer() webServer.addDefaultHandler(forMethod: "GET", request: GCDWebServerRequest.self, processBlock: {request in return GCDWebServerDataResponse(html:"

Hello World

") }) webServer.start(withPort: 8080, bonjourName: "GCD Web Server") print("Visit \(webServer.serverURL) in your web browser") } ``` ```objective-c #import #import ``` -------------------------------- ### Reloading App Changes Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/example/README.md Instructions for reloading your React Native application to see changes after modifying the code. This involves specific key presses or menu selections depending on the platform. ```bash For **Android**: Press the R key twice or select **"Reload"** from the **Developer Menu** (Ctrl + M (on Window and Linux) or Cmd ⌘ + M (on macOS)) For **iOS**: Hit Cmd ⌘ + R in your iOS Simulator to reload the app and see your changes! ``` -------------------------------- ### Lint Code Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Applies ESLint to check for code style and potential errors according to project standards. ```bash yarn lint ``` -------------------------------- ### GCDWebUploader iOS App Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Provides a ready-to-use HTML5 file uploader and downloader using GCDWebUploader in an iOS app. It allows users to upload, download, delete files, and create directories from a specified directory within the app's sandbox via a web browser. ```objective-c #import "GCDWebUploader.h" @interface AppDelegate : NSObject { GCDWebUploader* _webUploader; } @end @implementation AppDelegate - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]; _webUploader = [[GCDWebUploader alloc] initWithUploadDirectory:documentsPath]; [_webUploader start]; NSLog(@"Visit %@ in your web browser", _webUploader.serverURL); return YES; } @end ``` -------------------------------- ### Clean Build Folders Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Removes all build artifacts and temporary files from the project. This is useful for ensuring a clean build environment, especially when switching architectures or encountering build issues. ```bash yarn clean ``` -------------------------------- ### Fix Linting Errors Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Automatically fixes common formatting and linting issues in the codebase using ESLint with the --fix flag. ```bash yarn lint --fix ``` -------------------------------- ### Prepare Source Stream for Video Caching Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/src/Utils/__deprecated_func.txt The `prepareSourceStream` method is responsible for recursively downloading and preparing video stream segments and playlists (like M3U8 and TS files) for caching. It manages HTTP requests, cache key generation, and delegates events for playlist caching. The method handles potential errors and cleans up temporary download states. ```TypeScript /** * @deprecated The method should not be used */ private async prepareSourceStream(url: string): Promise { const Buffer = require('buffer').Buffer; const { originURL, cacheKey: prepareCacheKey } = getCacheKey( url, this.cacheFolder, KEY_PREFIX ); // download INDEPENDENT-SEGMENTS // download first SEGMENT // download MEDIA-SEQUENCE of SEGMENT // ignore download to file system // manually write it by cache provider try { // start download const httpRequest = this.sessionTask.dataTask(originURL.href, {}); // mark it as downloading this.cachingUrl[originURL.href] = httpRequest; const { data } = await httpRequest; const newTextData: string[] = Buffer.from(data, 'base64') .toString('utf8') .split('\n'); const scheme = originURL.protocol; const host = originURL.host; const firstPlaylist = newTextData.find((line) => line.endsWith('.m3u8')); const firstSegment = newTextData.find((line) => line.endsWith('.ts')); // manually write // this.cache.write(originURL.href, data); // prepare next download if (firstPlaylist) { const playlist = `${scheme}//${host}${pathReplaceLast( originURL.href, firstPlaylist )}`; // caching playlist only this.delegate?.onCachingPlaylistSource( originURL.href, data, this.cacheFolder ); // ignore segment cache file response // const resolutionPlaylist = await this.prepareSourceStream(playlist); } else if (firstSegment) { // ignore all media sequence cache file response const allMediaSequence = newTextData .filter((line) => line.includes('.ts')) .map( (line) => `${scheme}//${host}${pathReplaceLast(originURL.href, line)}` ); // const segments = await Promise.all( allMediaSequence.map((sequenceUrl) => this.prepareSourceStream(sequenceUrl) ) ); } // ignore ts cache key for downloaded ts file and segment m3u8 // if (prepareCacheKey.endsWith('.ts') || firstSegment) { // return ''; // } // return root m3u8 cache file if (this.errorCachingList[originURL.href]) { delete this.errorCachingList[originURL.href]; } return prepareCacheKey; } catch (error) { this.errorCachingList[originURL.href] = prepareCacheKey; throw error; // throw error; } finally { delete this.cachingUrl[originURL.href]; } } ``` -------------------------------- ### Type Check Code Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/CONTRIBUTING.md Verifies the codebase using TypeScript to ensure type safety and catch potential errors. ```bash yarn typecheck ``` -------------------------------- ### GCDWebDAVServer iOS App Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Implements a class 1 compliant WebDAV server using GCDWebDAVServer in an iOS app. This allows users to manage files (upload, download, delete, create directories) within the app's sandbox using any WebDAV client, including macOS Finder. ```objective-c #import "GCDWebDAVServer.h" // Example usage: // GCDWebDAVServer* davServer = [[GCDWebDAVServer alloc] initWithUploadDirectory:documentsPath]; // [davServer start]; // NSLog(@"Connect to %@ using a WebDAV client", davServer.serverURL); ``` -------------------------------- ### Handle Form Submission with GCDWebServer Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/ios/GCDWebServer/README.md Demonstrates adding a POST handler to process form submissions. It utilizes GCDWebServerURLEncodedFormRequest to automatically parse form arguments and echoes back the submitted value. ```Objective-C [webServer addHandlerForMethod:@"POST" path:@"/" requestClass:[GCDWebServerURLEncodedFormRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { NSString* value = [[(GCDWebServerURLEncodedFormRequest*)request arguments] objectForKey:@"value"]; NSString* html = [NSString stringWithFormat:@"

%@

", value]; return [GCDWebServerDataResponse responseWithHTML:html]; }]; ``` -------------------------------- ### Simple Video Caching Usage Source: https://github.com/nguyenvanphituoc/react-native-cache-video/blob/main/README.md Demonstrates basic usage of react-native-cache-video without a provider. It sets a video playback URL and retrieves the cached URL for use with the Video component. This method does not support HLS caching. ```javascript import React from 'react'; import { useAsyncCache } from 'react-react-native-cache-video'; import Video from 'react-native-video'; // Assuming react-native-video is used // your customize video component const MyVideoPlayer = ({ uri }) => { const { setVideoPlayUrlBy, cachedVideoUrl } = useAsyncCache(); React.useEffect(() => { setVideoPlayUrlBy(uri); }, [setVideoPlayUrlBy, uri]); return