Skip to content

Commit 7ff2797

Browse files
committed
update video sample
1 parent 387fb4a commit 7ff2797

16 files changed

+23
-87
lines changed

samples/11-video/bin/Main.js

-6
This file was deleted.

samples/11-video/bin/Main.swf

-173 KB
Binary file not shown.

samples/11-video/bin/index_flash.html

-24
This file was deleted.

samples/11-video/build/compile-js.hxml

-3
This file was deleted.

samples/11-video/build/compile-nme.nmml

-32
This file was deleted.

samples/11-video/build/compile-swf.hxml

-7
This file was deleted.

samples/11-video/project.xml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<project>
3+
4+
<meta title="Video" package="com.samples.cocktail" version="1.0.0" company="SilexLabs" />
5+
<app main="src.Main" path="bin" file="Video" />
6+
7+
<source path="src" />
8+
<assets path="res"></assets>
9+
<assets path="res/sober" rename="sober"></assets>
10+
11+
<haxelib name="openfl" />
12+
<haxelib name="cocktail" />
13+
14+
</project>

samples/11-video/bin/index.html samples/11-video/res/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<div class="player">
1515
<h1>Woot player</h1>
1616
<video width="500" height="280">
17-
<source src="assets/trailer.mp4" type="video/mp4"></source>
18-
<source src="assets/trailer.ogv" type="video/ogg"></source>
17+
<source src="res/trailer.mp4" type="video/mp4"></source>
18+
<source src="res/trailer.ogv" type="video/ogg"></source>
1919
</video>
2020
<div class="controls">
2121
<div class="track">
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

samples/11-video/src/Main.hx

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
package src;
12

23
/*
34
* Cocktail, HTML rendering engine
@@ -8,9 +9,10 @@
89
* http://www.silexlabs.org/labs/cocktail-licensing/
910
*/
1011

11-
import js.Browser;
12-
import js.html.InputElement;
13-
import js.html.HtmlElement;
12+
import cocktail.Browser;
13+
import cocktail.html.InputElement;
14+
import cocktail.html.HtmlElement;
15+
import cocktail.html.VideoElement;
1416

1517
/**
1618
* Showcases how to display a video in flash
@@ -19,17 +21,15 @@ class Main
1921
{
2022
static function main()
2123
{
22-
#if !js
2324
//init cocktail, and starts the load of the "index.html" file
24-
cocktail.api.Cocktail.boot();
25-
#end
25+
cocktail.api.Cocktail.boot("res/index.html");
2626

2727
Browser.window.onload = function(e) new Main();
2828
}
2929

3030
public function new()
3131
{
32-
var video:js.html.VideoElement = cast Browser.document.getElementsByTagName("video")[0];
32+
var video:VideoElement = cast Browser.document.getElementsByTagName("video")[0];
3333

3434
var playBtn:InputElement = cast Browser.document.querySelector("input[type=button][value=play]");
3535

@@ -89,13 +89,7 @@ class Main
8989
fullscreenBtn.onclick = function(e) {
9090
if (fullscreenBtn.value == "full") {
9191
fullscreenBtn.value = "small";
92-
#if js
93-
//for Haxe JS API need this extra param, didn't find any
94-
//doc about it
95-
player.requestFullScreen(0);
96-
#else
9792
player.requestFullScreen();
98-
#end
9993
}
10094
else {
10195
fullscreenBtn.value = "full";

0 commit comments

Comments
 (0)