Installation
Get NativeFrame installed in your project
Prerequisites
Before installing NativeFrame, ensure you have:
What you'll need
For all implementations:
- Modern web browser (Chrome 74+, Firefox 68+, Safari 12.1+, Edge 79+)
- HTTPS enabled website (required for camera/microphone access, except localhost)
For React:
- Node.js 14+ and npm/yarn
- React 16.8 or higher (hooks support required)
For Vanilla JavaScript (CDN):
- Modern browser with ES modules support
- Web server to serve HTML files (for development)
From NativeFrame:
- Authentication token (JWT)
- Stream key
- Backend endpoint (e.g.,
https://your-subdomain.nativeframe.com)
Contact NativeFrame if you don't have credentials yet.
Choose Your Installation Method
NativeFrame provides two packages depending on your needs:
- React (@video/video-client-react)
- Core (@video/video-client-core)
React Package
The @video/video-client-react package provides React-specific hooks, components, and Context providers for building video applications with React.
What's included:
- React hooks:
usePreviewPlayer,useAuthClient,useCallControls, etc. - Context Providers:
MediaStreamControllerAPIProvider,PlayerAPIProvider, etc. - Pre-built components:
<Video />,<DeviceSelector />, etc. - Full TypeScript support with type definitions
- Optimized for React 16.8+ with hooks
Best for:
- React applications
- Projects using modern React patterns
- TypeScript projects
- Applications needing reusable video components
Core Package
The @video/video-client-core package provides the core NativeFrame functionality without framework dependencies. Use this for Vanilla JavaScript projects or integration with non-React frameworks.
What's included:
- Core SDK for video streaming
- Direct API access:
createCall,createPlayer,mediaController, etc. - Full WebRTC functionality
- TypeScript type definitions
- Framework-agnostic implementation
Best for:
- Vanilla JavaScript projects
- Integration with Vue, Angular, Svelte, or other frameworks
- Projects without build tools
- Maximum flexibility and control
- Smaller bundle sizes (when using CDN)
Installation Instructions
- React (npm/yarn)
- Core (CDN)
- Core (npm/yarn)
Install React Package via npm
Update your .npmrc file to include:
@video:registry=https://npm-packages.nativeframe.com/
Install the React package using npm:
npm install @video/video-client-react
Or using yarn:
yarn add @video/video-client-react
Verify Installation
Create a simple component to verify the installation:
import React from 'react';
import { usePreviewPlayer } from '@video/video-client-react/hooks';
function TestComponent() {
const { mediaStreamController, previewPlayer, isLoading } = usePreviewPlayer();
if (isLoading) {
return <div>Loading...</div>;
}
return <div>NativeFrame React is installed! ✓</div>;
}
export default TestComponent;
If this compiles without errors, you're all set!
TypeScript Configuration
If you're using TypeScript, the package includes type definitions automatically. Ensure your tsconfig.json has:
{
"compilerOptions": {
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"jsx": "react"
}
}
Install Core Package via CDN
No npm installation needed! Load the core library directly from the NativeFrame CDN using an import map:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NativeFrame App</title>
<!-- Import map for NativeFrame -->
<script type="importmap">
{
"imports": {
"vdc-cdn": "https://cdn.nativeframe.com/video-client-core/14.0.0/index.js"
}
}
</script>
</head>
<body>
<div id="app"></div>
<script type="module">
import { createCall, BaseAuthClient } from 'vdc-cdn';
// Your code here
console.log('NativeFrame Core is loaded! ✓');
</script>
</body>
</html>
Version Pinning
The CDN URL includes the version number. Update the version to use different releases:
<script type="importmap">
{
"imports": {
"vdc-cdn": "https://cdn.nativeframe.com/video-client-core/14.0.0/index.js"
}
}
</script>
Available versions:
14.0.0- Current stable releaselatest- Always points to the latest version (not recommended for production)
Browser Requirements
Import maps require modern browser support:
- Chrome 89+
- Firefox 108+
- Safari 16.4+
- Edge 89+
For older browsers, consider using the npm installation method with a bundler.
Install Core Package via npm
Update your .npmrc file to include:
@video:registry=https://npm-packages.nativeframe.com/
Install the core package using npm:
npm install @video/video-client-core
Or using yarn:
yarn add @video/video-client-core
Bundler Configuration
Webpack
If using Webpack, ensure you have proper configuration for ES modules:
// webpack.config.js
module.exports = {
// ... other config
resolve: {
extensions: ['.js', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
}
]
}
};
Vite
Vite works out of the box with no additional configuration needed.
Rollup
// rollup.config.js
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
export default {
// ... other config
plugins: [
resolve(),
commonjs()
]
};
Verify Installation
Create a simple script to verify:
import { createCall, BaseAuthClient, mediaController } from '@video/video-client-core';
console.log('NativeFrame Core is installed! ✓');
console.log('Available methods:', { createCall, BaseAuthClient, mediaController });
TypeScript Configuration
The core package includes TypeScript definitions. Ensure your tsconfig.json has:
{
"compilerOptions": {
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"target": "ES2017",
"lib": ["ES2017", "DOM"]
}
}
Optional: Reduce Bundle Size
By default, the player includes hls.js and mpegts.js libraries in the bundle. You can exclude these to reduce bundle size (they'll load on-demand when needed).
Webpack Configuration
// webpack.config.js
const webpack = require('webpack');
module.exports = {
// ... other config
plugins: [
new webpack.DefinePlugin({
'process.env.HLSJS_BUNDLED': JSON.stringify('false'),
'process.env.MPEGTS_BUNDLED': JSON.stringify('false')
})
]
};
Vite Configuration
// vite.config.js
import { defineConfig } from 'vite';
export default defineConfig({
define: {
'process.env.HLSJS_BUNDLED': JSON.stringify('false'),
'process.env.MPEGTS_BUNDLED': JSON.stringify('false')
}
});
Trade-offs:
- ✅ Smaller initial bundle size
- ✅ Faster initial page load
- ❌ Small delay when starting playback (one-time library download)
- ❌ Additional network request
Recommendation:
- Include in bundle if most users will play video
- Lazy load if video playback is optional/rare
Verify Your Installation
After installation, verify everything works:
- React
- Vanilla JavaScript
Test React Installation
import React from 'react';
import { usePreviewPlayer, useAuthClient } from '@video/video-client-react/hooks';
import { MediaStreamControllerAPIProvider, PlayerAPIProvider } from '@video/video-client-react/context';
import { Video } from '@video/video-client-react/components';
function VerifyInstallation() {
const { mediaStreamController, previewPlayer, isLoading } = usePreviewPlayer();
const authClient = useAuthClient({
authUrl: 'https://your-subdomain.cdn.nativeframe.com/api/auth',
token: 'your-token-here'
});
if (isLoading) {
return <div>Loading camera...</div>;
}
return (
<MediaStreamControllerAPIProvider mediaStreamController={mediaStreamController}>
<PlayerAPIProvider player={previewPlayer}>
<div>
<h1>✓ Installation Verified!</h1>
<Video />
</div>
</PlayerAPIProvider>
</MediaStreamControllerAPIProvider>
);
}
export default VerifyInstallation;
Run your app and you should see your camera preview. If you see the video, your installation is successful!
Test Vanilla JS Installation
<!DOCTYPE html>
<html>
<head>
<script type="importmap">
{
"imports": {
"vdc-cdn": "https://cdn.cdn.nativeframe.com/video-client-core/14.0.0/index.js"
}
}
</script>
</head>
<body>
<h1>Installation Verification</h1>
<div id="status">Checking installation...</div>
<div id="preview"></div>
<script type="module">
import {
createCall,
BaseAuthClient,
mediaController,
requestPlayer
} from 'vdc-cdn';
// Check if imports work
document.getElementById('status').textContent = '✓ NativeFrame Core loaded successfully!';
// Test camera access
try {
await mediaController.initialize();
const msc = mediaController.createMediaStreamController();
const player = await requestPlayer({
mediaStreamController: msc,
muted: true
});
const video = document.createElement('video');
video.style.width = '640px';
video.style.height = '480px';
document.getElementById('preview').appendChild(video);
player.attach(video);
document.getElementById('status').textContent = '✓ Installation verified! Camera preview should appear below.';
} catch (error) {
document.getElementById('status').textContent = '⚠️ Installation OK, but camera access failed: ' + error.message;
console.error(error);
}
</script>
</body>
</html>
Open this file in a browser and you should see your camera preview. If you see the video, your installation is successful!
Troubleshooting Installation Issues
Common Installation Problems
Module not found
Problem: Cannot find module '@video/video-client-react'
Solutions:
- Verify installation:
npm list @video/video-client-react - Delete
node_modulesand reinstall:rm -rf node_modules && npm install - Clear npm cache:
npm cache clean --force - Check
package.jsonto ensure the package is listed in dependencies
Import map not supported
Problem: Browser doesn't support import maps
Solutions:
- Update to a modern browser version (Chrome 89+, Firefox 108+, Safari 16.4+)
- Use the npm installation method instead with a bundler
- Use an import map polyfill (not recommended for production)
TypeScript errors
Problem: TypeScript compilation errors with NativeFrame types
Solutions:
- Ensure you have the latest version:
npm update @video/video-client-react - Check your
tsconfig.jsonsettings (see TypeScript configuration above) - Add
"skipLibCheck": truetotsconfig.jsonas a temporary workaround - Restart your TypeScript server / IDE
Still Having Issues?
Check our Troubleshooting Guide for more solutions, or see the Getting Help section below.
Getting Help
If you encounter issues during installation:
- Check documentation - Review the Getting Started guide
- Search FAQ - Visit our FAQ for common questions
- Troubleshooting - Check the Troubleshooting Guide
- Contact support - Reach out to NativeFrame support with:
- Node.js and npm/yarn version:
node -v && npm -v - Package version:
npm list @video/video-client-react - Error messages and stack traces
- Browser and OS information
- Node.js and npm/yarn version:
Next Steps
Now that NativeFrame is installed, you're ready to start building:
📖 Continue Learning:
- Getting Started Guide - Build your first broadcaster and viewer
- Set up a Livestream - Create a complete broadcasting application
- View a Stream - Build a video player
🎯 Quick Links:
- Broadcasting Guide - Learn about broadcasting features
- Viewing Guide - Learn about playback and viewing
Happy streaming! 🎥