A modern video gallery application built with Go, featuring a responsive grid layout and interactive video playback.
- Responsive video grid layout that adapts to different screen sizes
- Hover-to-play video previews
- Interactive play/pause controls
- Video streaming with support for various video formats
- Automatic video metadata extraction (duration, title)
- Automatic thumbnail generation for video previews
- Modern and clean user interface
- HTTP caching support for improved video playback performance
- Range request support for efficient video streaming
- Go 1.16 or higher
- FFmpeg (for video metadata extraction)
- Clone the repository:
git clone https://github.com/yourusername/go-video.git
cd go-video- Install dependencies:
go mod download- Create a
videosdirectory in the project root:
mkdir videos-
Place your video files in the
videosdirectory. Supported formats include:- MP4
- WebM
- MKV
- QuickTime
- AVI
-
Start the server:
go run main.go- Open your browser and navigate to:
http://localhost:8080/videos
GET /videos- Displays the video gallery interfaceGET /stream/{filename}- Streams a video file with support for:- HTTP caching (1-hour cache duration)
- Range requests for partial content
- ETag and Last-Modified validation
go-video/
├── main.go # Application entry point
├── handlers/ # HTTP request handlers
│ ├── list_videos.go
│ └── video_handler.go
├── templates/ # HTML templates
│ ├── base.html
│ └── videos.html
├── videos/ # Video storage directory
├── thumbnails/ # Generated video thumbnails
├── go.mod # Go module definition
└── go.sum # Go module checksums
- Create new handlers in the
handlersdirectory - Add corresponding templates in the
templatesdirectory - Update routes in
main.go
The application uses modern CSS features:
- CSS Grid for responsive layout
- Flexbox for alignment
- CSS transitions for smooth animations
- Modern CSS properties for visual effects
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Go - The programming language
- FFmpeg - For video processing
- h2non/filetype - For file type detection