UNPKG

spotclip

Version:

Instagram-Style Video Widget for websites

196 lines (157 loc) β€’ 4.71 kB
# πŸŽ₯ SpotVid - Instagram-Style Video Widget Transform your website with engaging, vertical-scrolling video content that captures your visitors' attention! ## ✨ Features - πŸ”΅ Sleek, floating video button in customizable positions - πŸ“± Full-screen vertical video experience (like Instagram Reels) - 🎯 Smooth scrolling between videos - πŸ”Š Easy sound controls and intuitive interface - 🎬 Support for MP4 and HLS video formats - πŸ“± Responsive design for all devices - πŸš€ Lightweight (<50KB gzipped) - πŸ”„ Video preloading for instant playback - 🎨 Highly customizable appearance - πŸ“Š Built-in analytics hooks ## πŸš€ Getting Started ### Basic Installation Add the script to your HTML: ```html <script src="https://cdn.spotvid.com/v1/spotvid.min.js"></script> ``` Initialize with configuration: ```html <script> window.SpotVid.init({ videos: [{ url: 'https://example.com/video1.mp4', title: 'Product 1', thumbnail: 'https://example.com/thumb1.jpg', link: 'https://example.com/product1' }], style: { widget_x_position: 0, // 0 = left, 100 = right widget_y_position: 0, // 0 = bottom, 100 = top size: '150px' } }); </script> ``` ### NPM Installation ```bash npm install spotvid-widget ``` ```javascript import SpotVid from 'spotvid-widget'; new SpotVid({ videos: [...], style: {...} }); ``` ## πŸ’» Technical Requirements - Modern browsers (Chrome, Firefox, Safari, Edge) - Support for ES6+ JavaScript - Minimal impact on page load (<100ms) - Bandwidth for video streaming ## βš™οΈ Configuration Options ```javascript { videos: [{ url: string, // Video URL (required) title: string, // Video title thumbnail: string, // Thumbnail image URL link: string, // CTA link URL duration: number // Video duration in seconds }], style: { widget_x_position: number, // 0-100: 0 = left, 100 = right widget_y_position: number, // 0-100: 0 = bottom, 100 = top size: string, // Widget size (e.g. '150px') borderColor: string, // Border color borderWidth: string, // Border width pillBackground: string, // Notification pill background pillTextColor: string // Notification pill text color }, mode: string, // 'stories' | 'reels' pillText: string, // Notification text ctaText: string, // Call-to-action button text analytics: { onPlay: Function, // Play event callback onComplete: Function, // Complete event callback onCTA: Function // CTA click callback } } ``` ## πŸ“± Mobile Experience Optimized for mobile devices with: - Touch-friendly controls - Smooth vertical swiping - Adaptive video quality - Portrait mode optimization - Safe area handling - Gesture navigation ## 🎯 Events & Analytics ```javascript SpotVid.init({ analytics: { onPlay: (videoId) => { console.log(`Video ${videoId} started playing`); }, onComplete: (videoId) => { console.log(`Video ${videoId} completed`); }, onCTA: (videoId, url) => { console.log(`CTA clicked for video ${videoId}`); } } }); ``` ## πŸ”’ Security & Performance - HTTPS video delivery - CDN distribution - Efficient preloading - Minimal bundle size - Content security policy compliant - Cross-origin resource sharing ## πŸ›  API Methods ```javascript const widget = new SpotVid(config); // Control methods widget.play(); // Play current video widget.pause(); // Pause current video widget.next(); // Go to next video widget.previous(); // Go to previous video widget.setMuted(boolean); // Toggle sound widget.destroy(); // Remove widget // State methods widget.isPlaying(); // Check if playing widget.getCurrentVideo(); // Get current video data widget.getConfig(); // Get current config ``` ## 🎨 Styling Custom CSS variables for styling: ```css :root { --spotvid-primary: #000000; --spotvid-text: #FFFFFF; --spotvid-border-radius: 50%; --spotvid-shadow: 0 2px 10px rgba(0,0,0,0.2); --spotvid-z-index: 999; } ``` ## πŸ›  Support Need help? We've got you covered: - πŸ“§ Email: support@spotvid.com - πŸ’¬ Discord: [Join our community](https://discord.gg/spotvid) - πŸ“š Documentation: [docs.spotvid.com](https://docs.spotvid.com) - πŸ› Issues: [GitHub Issues](https://github.com/axioms-studio/spotvid/issues) ## πŸ—ΊοΈ Roadmap Coming soon: - πŸ“Š Enhanced analytics - 🌐 Social sharing - 🎯 A/B testing - πŸ“Ί Live streaming - πŸ”„ Auto-play options - 🎨 More themes ## πŸ“„ License MIT License - Copyright (c) 2024 Axioms Studio --- Made with ❀️ by [Axioms Studio](https://axioms.studio)