feat: Add Streaming Video Example App with Content Gating#20
feat: Add Streaming Video Example App with Content Gating#20ToanBm wants to merge 15 commits intoshelby:mainfrom
Conversation
…es, translate messages, add error handling
…k, remove unused files
…idation, consistency
| account: account.address, | ||
| blobName, | ||
| blobData: new Uint8Array(buffer), | ||
| }); |
There was a problem hiding this comment.
Blob upload failure after transaction leaves user with unusable content
Medium Severity
The uploadVideo function submits the blockchain transaction to register blob metadata (line 69) before uploading the actual blob data to storage (lines 72-76). If putBlob fails after the transaction succeeds, the user has paid gas fees for metadata pointing to non-existent content. The video will be registered on-chain but unplayable, with no way to recover.
| blobName, | ||
| expirationMicros: expirationMicros.toString(), | ||
| nowMicros: BigInt(Date.now() * 1000).toString() | ||
| }); |
There was a problem hiding this comment.
Debug console.log statements in production code
Low Severity
Multiple console.log statements appear to be debugging code left in production files. In useUploadVideo.tsx, there's a "Debug Upload" log with transaction details. In VideoPlayer.tsx, there are "Ready to play" and "Started playing" logs. In page.tsx, there's a "Transaction Hash" log. These pollute the browser console and may leak sensitive information.
Additional Locations (2)
| export const Header = () => { | ||
| const { connected, account, connect, wallets, disconnect } = useWallet(); | ||
| const [isDropdownOpen, setIsDropdownOpen] = useState(false); | ||
| const dropdownRef = useRef<HTMLDivElement>(null); |
There was a problem hiding this comment.
Header component missing "use client" directive
Low Severity
The Header component uses React hooks (useState, useRef, useEffect) and the useWallet hook but lacks the "use client" directive that all other components in the same directory have. While it currently works because it's imported by page.tsx (a client component), this is inconsistent with the codebase patterns and fragile if the component is ever imported elsewhere.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| owner: "0x1", | ||
| url: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/Sintel.mp4" | ||
| } | ||
| ]; |
There was a problem hiding this comment.
Demo videos send payments to system address
High Severity
The default demo videos (big_buck_bunny and sintel) have owner: "0x1", which is the Aptos framework address. When users click "Unlock" on these videos, the handleUnlock function sends APT payments to address "0x1" via coin::transfer. This results in users losing real funds (0.1-0.2 APT per video) to a system address that no user controls. Demo content intended for testing the app shouldn't require payment to an unrecoverable address.
Additional Locations (1)
apps/streaming-video/app/page.tsx
Outdated
| className="flex overflow-x-auto gap-4 scroll-smooth no-scrollbar pb-8 pt-2 px-1" | ||
| style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }} | ||
| > | ||
| {filteredVideos.map((vid, idx) => { |
There was a problem hiding this comment.
📹 Overview
This PR introduces a new example application demonstrating decentralized video streaming with content gating using the Shelby Protocol on Aptos blockchain.
✨ Key Features
🛠️ Technical Implementation
@aptos-labs/wallet-adapter-react📁 Files Added
apps/streaming-video/- Complete Next.js applicationapps/streaming-video/components/- Reusable UI components (Header, VideoPlayer, VideoUploader)apps/streaming-video/hooks/- Custom React hooks for video storage🔧 Additional Changes
@aptos-labs/ace-sdkin apps/solana/token-gated/package.json🧪 Testing
🚀 How to Test