Documentation
¶
Overview ¶
Package mjpeg implements mjpeg streaming handlers with a simple API.
Example ¶
stream := func() image.Image {
img := image.NewGray(image.Rect(0, 0, 100, 100))
for i := 0; i < 100; i++ {
for j := 0; j < 100; j++ {
n := rand.Intn(256)
gray := color.Gray{uint8(n)}
img.SetGray(i, j, gray)
}
}
return img
}
handler := mjpeg.Handler{
Stream: stream,
Options: &jpeg.Options{Quality: 60},
}
mux := http.NewServeMux()
mux.Handle("/stream", handler)
log.Fatal(http.ListenAndServe(":8080", mux))
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
A Handler is an http.Handler that streams mjpeg using an image stream. Encoding quality can be controlled using the Options parameters.
Source Files
¶
- mjpeg.go
Click to show internal directories.
Click to hide internal directories.