aboutsummaryrefslogtreecommitdiffstats
path: root/examples/static
diff options
context:
space:
mode:
Diffstat (limited to 'examples/static')
-rw-r--r--examples/static/README.md5
-rw-r--r--examples/static/priv/small.mp4bin0 -> 383631 bytes
-rw-r--r--examples/static/priv/small.ogvbin0 -> 872453 bytes
-rw-r--r--examples/static/priv/video.html11
-rw-r--r--examples/static/src/static_app.erl8
-rwxr-xr-xexamples/static/start.sh3
6 files changed, 22 insertions, 5 deletions
diff --git a/examples/static/README.md b/examples/static/README.md
index ef46312..78f5338 100644
--- a/examples/static/README.md
+++ b/examples/static/README.md
@@ -42,3 +42,8 @@ $ curl -sLO http://localhost:8080/test.txt
$ cat test.txt
If you read this then the static file server works!
```
+
+HTML5 Video Example
+-------------------
+
+Open http://localhost:8080/video.html in your favorite browser.
diff --git a/examples/static/priv/small.mp4 b/examples/static/priv/small.mp4
new file mode 100644
index 0000000..1fc4788
--- /dev/null
+++ b/examples/static/priv/small.mp4
Binary files differ
diff --git a/examples/static/priv/small.ogv b/examples/static/priv/small.ogv
new file mode 100644
index 0000000..6409d6e
--- /dev/null
+++ b/examples/static/priv/small.ogv
Binary files differ
diff --git a/examples/static/priv/video.html b/examples/static/priv/video.html
new file mode 100644
index 0000000..eca63ee
--- /dev/null
+++ b/examples/static/priv/video.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <h1>HTML5 Video Example</h1>
+ <video controls>
+ <source src="small.ogv" type="video/ogg"/>
+ <source src="small.mp4" type="video/mp4"/>
+ </video>
+ <p>Videos taken from <a href="http://techslides.com/sample-webm-ogg-and-mp4-video-files-for-html5/">TechSlides</a></p>
+</body>
+</html>
diff --git a/examples/static/src/static_app.erl b/examples/static/src/static_app.erl
index 16ef554..a2b9c31 100644
--- a/examples/static/src/static_app.erl
+++ b/examples/static/src/static_app.erl
@@ -11,16 +11,16 @@
%% API.
start(_Type, _Args) ->
- Dispatch = [
+ Dispatch = cowboy_router:compile([
{'_', [
- {['...'], cowboy_static, [
+ {"/[...]", cowboy_static, [
{directory, {priv_dir, static, []}},
{mimetypes, {fun mimetypes:path_to_mimes/2, default}}
]}
]}
- ],
+ ]),
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
- {dispatch, Dispatch}
+ {env, [{dispatch, Dispatch}]}
]),
static_sup:start_link().
diff --git a/examples/static/start.sh b/examples/static/start.sh
index ab15739..bc67846 100755
--- a/examples/static/start.sh
+++ b/examples/static/start.sh
@@ -1,3 +1,4 @@
#!/bin/sh
erl -pa ebin deps/*/ebin -s static \
- -eval "io:format(\"Point your browser at http://localhost:8080/test.txt~n\")."
+ -eval "io:format(\"Point your browser at http://localhost:8080/test.txt~n\")." \
+ -eval "io:format(\"Point your browser at http://localhost:8080/video.html~n\")."