Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
449 rajveer 1
/*
2
       * Chromeless player has no controls.
3
       */
4
 
5
      // Update a particular HTML element with a new value
6
      function updateHTML(elmId, value) {
7
        document.getElementById(elmId).innerHTML = value;
8
      }
9
 
10
      // This function is called when an error is thrown by the player
11
      function onPlayerError(errorCode) {
12
        alert("An error occured of type:" + errorCode);
13
      }
14
 
15
      // This function is called when the player changes state
16
      function onPlayerStateChange(newState) {
17
        updateHTML("playerState", newState);
18
      }
19
 
20
 
474 binay 21
      /*
449 rajveer 22
      // This function is automatically called by the player once it loads
23
      function onYouTubePlayerReady(playerId) {
24
        ytplayer = document.getElementById("ytPlayer");
25
        // This causes the updatePlayerInfo function to be called every 250ms to
26
        // get fresh data from the player
27
        //setInterval(updatePlayerInfo, 250);
28
        //updatePlayerInfo();
29
        ytplayer.addEventListener("onStateChange", "onPlayerStateChange");
30
        ytplayer.addEventListener("onError", "onPlayerError");
31
        //Load an initial video into the player
32
        ytplayer.cueVideoById("dceW9l72mTE");
33
      }
474 binay 34
      */
449 rajveer 35
      // The "main method" of this sample. Called when someone clicks "Run".
36
      function loadPlayer() {
37
        // Lets Flash from another domain call JavaScript
38
        var params = { allowScriptAccess: "always" };
39
        // The element id of the Flash embed
40
        var atts = { id: "ytPlayer" };
41
        // All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
42
        swfobject.embedSWF("http://www.youtube.com/apiplayer?" +
43
                           "&enablejsapi=1&playerapiid=ytplayer",
44
                           "videoDiv", "205", "275", "8", null, null, params, atts);
45
      }
46
      function _run() {
47
        loadPlayer();
48
      }