-
Notifications
You must be signed in to change notification settings - Fork 10
feat: Add Streaming Video Example App with Content Gating #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ToanBm
wants to merge
15
commits into
shelby:main
Choose a base branch
from
ToanBm:feature/streaming-video-example
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
28cbcab
feat: add streaming video example app
ToanBm 06835f6
fix: regenerate pnpm-lock.yaml to resolve broken dependency issue
ToanBm d472b70
fix: override broken @aptos-labs/ace-sdk dependency to allow installa…
ToanBm fce2b54
fix: prioritize Petra wallet and remove broken dependency
ToanBm 9f16d4e
fix: separate video display name from playback URL
ToanBm 79b3124
fix: address Cursor Bot feedback - update metadata, remove unused fil…
ToanBm 2ae0bb0
fix: address all Cursor Bot feedback - security fixes, restore ace-sd…
ToanBm dd0028d
fix: address all Cursor Bot issues - state management, precision, val…
ToanBm a56652d
fix: owner bypass, zero price validation, React keys, remove unused deps
ToanBm 24181b7
fix: owner comparison toString, upload error feedback, remove duplica…
ToanBm 7a5c11c
fix: remove ace-sdk noop override breaking token-gated app
ToanBm 34a3dca
fix: resolve streaming-video bugs and restore monorepo installation f…
ToanBm 96337a8
fix: final security, validation and UX polish for streaming-video app
ToanBm 49cbbb1
fix: add use client directive to Header component
ToanBm 822a405
fix: make demo videos free and remove unused idx
ToanBm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Shelby Protocol Configuration | ||
| NEXT_PUBLIC_SHELBY_API_URL=https://api.shelbynet.shelby.xyz | ||
|
|
||
| # Shelby API Key for enhanced rate limits | ||
| NEXT_PUBLIC_SHELBY_API_KEY=your_shelby_api_key_here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Shelby Streaming Video Example | ||
|
|
||
| This example demonstrates how to build a video streaming application with decentralized content gating using the Shelby Protocol. | ||
|
|
||
| ## Key Features | ||
|
|
||
| - **Real-time Streaming**: Utilizes Shelby SDK's `streamData` for low-latency video playback. | ||
| - **On-chain Gating**: Protects premium content with rules stored on-chain (Aptos/Solana). | ||
| - **Micropayments**: Integrated "Tip-to-Unlock" flow for content monetization. | ||
| - **Wallet Integration**: Seamless connection with Aptos wallets (Petra, etc.). | ||
| ... | ||
| 2. **Access Rules**: Creators set a price (e.g., 0.5 APT) and their wallet address receives payments directly. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| ### 1. Installation | ||
|
|
||
| Install dependencies from the root of the monorepo: | ||
|
|
||
| ```bash | ||
| pnpm install | ||
| ``` | ||
|
|
||
| ### 2. Environment Setup | ||
|
|
||
| Copy `.env.example` to `.env` and fill in your API keys: | ||
|
|
||
| ```bash | ||
| cp .env.example .env | ||
| ``` | ||
|
|
||
| Required variables: | ||
| - `NEXT_PUBLIC_SHELBY_API_KEY`: Your Shelby Protocol API key. | ||
| - `NEXT_PUBLIC_APTOS_API_KEY`: Aptos network API key. | ||
|
|
||
| ### 3. Development | ||
|
|
||
| Run the development server: | ||
|
|
||
| ```bash | ||
| pnpm dev --filter=@shelby-protocol/streaming-video | ||
| ``` | ||
|
|
||
| Open [http://localhost:3005](http://localhost:3005) to view the app. | ||
|
|
||
| ## How it Works | ||
|
|
||
| 1. **Content Upload**: Videos are encrypted and uploaded as blobs to Shelby storage. | ||
| 2. **Access Rules**: A access policy is set (e.g., "Must pay 0.1 APT to address X"). | ||
| 3. **Streaming**: When a user visits the page, the app checks for the payment. If not found, the `VideoPlayer` displays a lock screen. | ||
| 4. **Unlocking**: Upon payment, the Shelby SDK provides the authorized stream to the browser. | ||
|
|
||
| ## Built With | ||
|
|
||
| - [Next.js](https://nextjs.org/) | ||
| - [Shelby SDK](https://docs.shelby.xyz) | ||
| - [React Player](https://github.com/cookpete/react-player) | ||
| - [Tailwind CSS](https://tailwindcss.com/) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @import "@shelby-protocol/ui/globals.css"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { Toaster } from "@shelby-protocol/ui/components"; | ||
| import localFont from "next/font/local"; | ||
| import { WalletProvider } from "@/components/WalletProvider"; | ||
| import "./globals.css"; | ||
| import type { Metadata } from "next"; | ||
|
|
||
| const geistSans = localFont({ | ||
| src: "./fonts/GeistVF.woff", | ||
| variable: "--font-geist-sans", | ||
| }); | ||
| const geistMono = localFont({ | ||
| src: "./fonts/GeistMonoVF.woff", | ||
| variable: "--font-geist-mono", | ||
| }); | ||
|
|
||
| export const metadata: Metadata = { | ||
| title: "Shelby Streaming Video Example", | ||
| description: "A decentralized video streaming example with content gating using Shelby Protocol", | ||
| }; | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export default function RootLayout({ | ||
| children, | ||
| }: Readonly<{ | ||
| children: React.ReactNode; | ||
| }>) { | ||
| return ( | ||
| <html lang="en"> | ||
| <body className={`${geistSans.variable} ${geistMono.variable}`}> | ||
| <WalletProvider> | ||
| {children} | ||
| <Toaster /> | ||
| </WalletProvider> | ||
| </body> | ||
| </html> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.