Skip to content

Commit

Permalink
Images added to live_webm
Browse files Browse the repository at this point in the history
  • Loading branch information
michalderkacz committed Jul 28, 2011
1 parent 873890f commit c78ce11
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Binary file added examples/images/logo-153x55.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion examples/live_webm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ func (ix *Index) ServeHTTP(wr http.ResponseWriter, req *http.Request) {
<title>Live WebM video</title>
</head>
<body>
<video src='/video' width=%d height=%d autoplay></video>
<img src='/images/logo.png' alt=logo1><br>
<video src='/video' width=%d height=%d autoplay></video><br>
<img src='/images/logo-153x55.png' alt=logo2>
</body>
</html>`

Expand Down Expand Up @@ -132,13 +134,18 @@ func NewWebM(width, height, fps int) *WebM {
return wm
}

func staticHandler(wr http.ResponseWriter, req *http.Request) {
http.ServeFile(wr, req, req.URL.Path[1:])
}

func main() {
index := &Index{384, 216}
wm := NewWebM(index.width, index.height, 25)
wm.Play()

http.Handle("/", index)
http.Handle("/video", wm)
http.HandleFunc("/images/", staticHandler)
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatalln("http.ListenAndServe:", err)
Expand Down

0 comments on commit c78ce11

Please sign in to comment.