forked from mangui/flashls
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPlayer.as
32 lines (28 loc) · 1.04 KB
/
Player.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mangui.basic {
import org.mangui.hls.HLS;
import org.mangui.hls.event.HLSEvent;
import flash.display.Sprite;
import flash.media.Video;
public class Player extends Sprite {
private var hls : HLS = null;
private var video : Video = null;
public function Player() {
hls = new HLS();
hls.stage = this.stage;
video = new Video(640, 480);
addChild(video);
video.x = 0;
video.y = 0;
video.smoothing = true;
video.attachNetStream(hls.stream);
hls.addEventListener(HLSEvent.MANIFEST_LOADED, manifestHandler);
hls.load("http://domain.com/hls/m1.m3u8");
}
public function manifestHandler(event : HLSEvent) : void {
hls.stream.play(null, -1);
};
}
}