Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
73 lines (63 sloc) 2.7 KB

VLC with YUI plugin

We design this utility to help some VLC web plugin's leak. The player's state change detection. The old version crash issue (still improve). The browser's compatibility (IE, FireFox and Chrome should work).

How to use.

  1. First thing, you might include YUI 3 seed in your html file and this vlc.js.
<script type="text/javascript" src=""></script>
<script type="text/javascript" src="vlc.js"></script>
  1. Use this vlc plugin by the following code.
 YUI().use("vlc","node-event-delegate", function (Y) {});
  1. Create variable and its config.
 var vlc, config;
         config = {
             "container": "#vlc",
             "url": ""
         vlc = new Y.VLC(config);
  1. Config has many setting attributes (still in developing).
container : You can settup where your vlc plugin to show.
    url       : The streaming url you will play.
    autoPlay  : Will vlc player autoplay this streaming?
    size      : Array to control vlc player's width and height,
                [0] is width, [1] is height.
  1. You also can access some attributes by using YUI ATTRS access method. Just access like sample code: vlc.get("installed");
installed  : Is your browser install vlc web plugin?
    state      : The state of current vlc player state
                ("idle", "opening", "buffering", "playing", "paused",
                 "stopped", "ended", "error")
    positin    : The video current playing time.
    duration   : The video total playing length.
    volume     : The volume setting (0-200)
    size       : The player's width and height (using array).
    fullscrren : Set player fullscreen.
  1. State detection - thank god the YUI ATTR has change event, even origin vlc web plugin state change event is not working. We can still detect its state.
 vlc.on("buffering", function(e){ //when player is buffering
        Y.log("VLC buffering");
    vlc.on("ready", function(e){    //when player is ready
        Y.log("VLC ready");
    //When vlc is playing, e.duration and e.postion can be access
    //for timeline purpose.
    vlc.on("playing", function(e){
        Y.log("playing - duration = " + e.duration + "/ position = " + e.position);
    //When vlc state change, YUI can detech the state change event.
    vlc.after("stateChange", function(e){
        Y.log("State change from "+e.prevVal +" to "+e.newVal );
  1. Some issue The autoPlay attribute still has some problems, we are trying to figure it out.