This repository is a minimal Next.js application demonstrating how to integrate the VdoCipher secure video player. It displays a protected video using a server-side OTP (one time password) request.
- Simple next/app layout with a single video page
- Server-side fetch of VdoCipher OTP and playback info
- Client IP detection for geo/whitelist locking
- Sample data file (
data/videos.ts) with VdoCipher video IDs - Environment-based configuration using
VDOCIPHER_API_KEY
app/ # Next.js app directory
page.tsx # Home page that loads a VdoCipher iframe
data/
videos.ts # Array of sample video metadata
utils/
getClientIp.ts # Utility for extracting client IP from headers
public/ # Static assets
... # Standard Next.js config files
-
Clone the repo
git clone https://github.com/yourusername/vdocipher.git cd vdocipher -
Install dependencies
npm install # or yarn # or pnpm install
-
Configure environment variable
Create a
.env.localfile at the project root with your VdoCipher API key:VDOCIPHER_API_KEY=your_api_secret_here
You can obtain the API key from your VdoCipher dashboard.
-
Run the development server
npm run dev # or yarn devOpen http://localhost:3000 in your browser.
-
Change videos
Update
data/videos.tswith your ownvdoCipherIdvalues, or extend the page logic to iterate through the list.
Below is a walkthrough of how the integration works. Click the thumbnail to watch on YouTube or use the embedded player.
<iframe width="560" height="315" src="https://www.youtube.com/embed/TtvLJimE6kE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>You can deploy this Next.js app to Vercel (recommended) or any platform that supports Node.js.
- Push your code to a Git provider (GitHub, GitLab, etc.)
- Import the repository in Vercel and set the
VDOCIPHER_API_KEYenvironment variable in the dashboard - Trigger a deployment
- The OTP request is made server-side (
app/page.tsx) to keep the API key secret. - Customize the watermarking/annotations payload in the fetch body to fit your requirements.
- Use
getClientIpto restrict playback based on user location.
Contributions are welcome! Feel free to open issues or pull requests with improvements.
This project is licensed under the MIT License.
Happy coding! 🎬
