Changeset 1938


Ignore:
Timestamp:
08/05/11 11:35:33 (22 months ago)
Author:
jeroen
Message:

initial cleanup of Flash related. Most test working, but tweaks needed

Location:
plugins/related
Files:
9 added
14 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • plugins/related/build/build.xml

    r1930 r1938  
    1616    <target name="buildAS" depends="buildJS"> 
    1717        <exec executable="/Developer/SDKs/flex_sdk_4/bin/mxmlc" dir="../"> 
    18             <arg line="src/as/com/longtailvideo/plugins/related/Related.as" /> 
     18            <arg line="src/as/Related.as" /> 
    1919            <arg line="-o related.swf" /> 
    2020            <arg line="-sp src/as" /> 
  • plugins/related/src/js/related.js

    r1930 r1938  
    1 /* 
    2 * Related Javascript plugin for JWPlayer 5 
    3 * 
    4 * @author: pyen 
    5 */ 
    61(function(jwplayer) { 
    72 
    8         // convenience variable 
    9         var _utils = jwplayer.utils; 
    10         var _players = null; 
    113 
    12         // plugin's options 
    13         var options = [ "useicons", "redirect", "onpause", "file", "uidebug" ]; 
    14         var hwconf = { 
    15                 "version"       : 1.0, 
    16                 "useicons"      : false, 
    17                 "redirect"      : false, 
    18                 "onpause"       : false, 
    19                 "uidebug"       : false 
    20         }; 
     4    /** This plugin displays a screen with related videos.**/ 
     5    var template = function(_player, _options, _div) { 
    216 
    22         // internal image assets 
    23         var imageAssets = { 
    24                 "icon"          : "relatedIcon.png", 
    25                 "panel"         : "relatedBack.png", 
    26                 "close"         : "relatedClose.png", 
    27                 "replay"        : "relatedReplay.png", 
    28                 "prev"          : "relatedPrev.png", 
    29                 "next"          : "relatedNext.png" 
    30         }; 
    317 
    32         // thumbnails 
    33         var items = []; 
    34         var items_per_page = 4; 
     8        /** Reposition elements upon a resize. **/ 
     9        this.resize = function(width,height) {}; 
    3510 
    36         // sliding pages of thumbnails 
    37         var pages = []; 
    38         var page_index = 0; 
    3911 
    40         // position pairs; reasonably constant 
    41         var page_positions = [ 
    42                 [0, 0], 
    43                 [140, 0], 
    44                 [0, 100], 
    45                 [140, 100] 
    46         ]; 
     12    }; 
    4713 
    48         // hooks to graphics during resize 
    49         // canvas  
    50         // +-- backdrop 
    51         // +-- panel 
    52         //       +-- close 
    53         //       +-- replay button 
    54         //       +-- prev button 
    55         //       +-- next button 
    56         //       +-- pages 
    57         // (some non-canvase components are accessible for resize, show/hide cases) 
    58         var canvas              = document.createElement("div"); 
    59         var backdrop    = document.createElement("div"); 
    60         var panel               = document.createElement("div"); 
    61         var nextButton  = document.createElement("div"); 
    62         var prevButton  = document.createElement("div"); 
    6314 
    64         // -------------------------------------------------------------------------------- 
    65         // config related 
    66         // -------------------------------------------------------------------------------- 
    67         function loadConfig(player, config) { 
    68                 for (var i=0;i<options.length;i++) { 
    69                         if (config[options[i]] != undefined) { 
    70                                 hwconf[options[i]] = config[options[i]]; 
    71                         } 
    72                 } 
    73                 if (hwconf["onpause"] == true) { 
    74                         player.onPause(handleJwPause); 
    75                 } 
    76                 if (hwconf["useicons"] == true) { 
    77                         _player.getPlugin("dock").setButton("related", handleDockButtonClick, getImage("icon"), getImage("icon")); 
    78                 } 
    79         } 
    80  
    81         function version() { 
    82                 return "Related v" + hwconf["version"]; 
    83         } 
    84  
    85         function showconf() { 
    86                 var out = version(); 
    87                 for (var i=0;i<options.length;i++) { 
    88                         out += "\n" + options[i] + ": " + hwconf[options[i]]; 
    89                 } 
    90                 return out; 
    91         } 
    92  
    93         // -------------------------------------------------------------------------------- 
    94         // related to rendering of base display area 
    95         // -------------------------------------------------------------------------------- 
    96         function renderCanvas() { 
    97                 canvas = document.createElement("div"); 
    98                 _utils.css(canvas, { 
    99                         "display"               : "none", 
    100                         "color"                 : "white", 
    101                         "zIndex"                : 25, 
    102                         "fontFamily"    : "sans-serif" 
    103                 }); 
    104  
    105                 backdrop.onclick = handleClose; 
    106                 canvas.appendChild(backdrop); 
    107  
    108                 _utils.css(panel, { 
    109                         "backgroundImage"       : "url('"+getImage("panel")+"')", 
    110                         "opacity"                       : 1.0, 
    111                         "width"                         : 320, 
    112                         "height"                        : 240, 
    113                         "top"                           : "0px", 
    114                         "left"                          : "0px" 
    115                 }); 
    116                 canvas.appendChild(panel); 
    117  
    118                 // load panel 
    119                 var close = document.createElement("div"); 
    120                 _utils.css(close, { 
    121                         "position"                      : "absolute", 
    122                         "cursor"                        : "pointer", 
    123                         "backgroundImage"       : "url('"+getImage("close")+"')", 
    124                         "width"                         : 30, 
    125                         "height"                        : 40, 
    126                         "top"                           : "0px", 
    127                         "left"                          : "290px" 
    128                 }); 
    129                 if (is_debug()) { 
    130                         _utils.css(close, { 
    131                                 "width"                         : 28, 
    132                                 "height"                        : 38, 
    133                                 "border"                        : "1px dotted green", 
    134                                 "backgroundColor"       : 0x888888, 
    135                                 "opacity"                       : 0.5 
    136                         }); 
    137                 } 
    138                 close.onclick = handleClose; 
    139                 panel.appendChild(close); 
    140  
    141                 var replay = document.createElement("div"); 
    142                 _utils.css(replay, { 
    143                         "position"                      : "absolute", 
    144                         "cursor"                        : "pointer", 
    145                         "backgroundImage"       : "url('"+getImage("replay")+"')", 
    146                         "width"                         : 260, 
    147                         "height"                        : 40, 
    148                         "top"                           : "0px", 
    149                         "left"                          : "30px" 
    150                 }); 
    151                 if (is_debug()) { 
    152                         _utils.css(replay, { 
    153                                 "width"                         : 258, 
    154                                 "height"                        : 38, 
    155                                 "border"                        : "1px dotted blue", 
    156                                 "backgroundColor"       : 0x888888, 
    157                                 "opacity"                       : 0.5 
    158                         }); 
    159                 } 
    160                 replay.onclick = handleReplay; 
    161                 panel.appendChild(replay); 
    162  
    163                 _utils.css(prevButton, { 
    164                         "position"                      : "absolute", 
    165                         "cursor"                        : "pointer", 
    166                         "backgroundImage"       : "url('"+getImage("prev")+"')", 
    167                         "width"                         : 30, 
    168                         "height"                        : 180, 
    169                         "top"                           : "40px", 
    170                         "left"                          : "0px" 
    171                 }); 
    172                 if (is_debug()) { 
    173                         _utils.css(prevButton, { 
    174                                 "width"                         : 28, 
    175                                 "height"                        : 178, 
    176                                 "border"                        : "1px dotted white", 
    177                                 "backgroundColor"       : 0x888888, 
    178                                 "opacity"                       : 0.5 
    179                         }); 
    180                 } 
    181                 prevButton.onclick = handlePrev; 
    182                 panel.appendChild(prevButton); 
    183  
    184                 _utils.css(nextButton, { 
    185                         "position"                      : "absolute", 
    186                         "cursor"                        : "pointer", 
    187                         "backgroundImage"       : "url('"+getImage("next")+"')", 
    188                         "width"                         : 30, 
    189                         "height"                        : 180, 
    190                         "top"                           : "40px", 
    191                         "left"                          : "290px" 
    192                 }); 
    193                 if (is_debug()) { 
    194                         _utils.css(nextButton, { 
    195                                 "width"                         : 28, 
    196                                 "height"                        : 178, 
    197                                 "border"                        : "1px dotted white", 
    198                                 "backgroundColor"       : 0x888888, 
    199                                 "opacity"                       : 0.5 
    200                         }); 
    201                 } 
    202                 nextButton.onclick = handleNext; 
    203                 panel.appendChild(nextButton); 
    204  
    205         } 
    206  
    207         // -------------------------------------------------------------------------------- 
    208         // related to file loading and thumbnail packing 
    209         // -------------------------------------------------------------------------------- 
    210         function loadData(evt) { 
    211                 var url = null; 
    212                 if (evt != undefined && evt.index >= 0) { 
    213                         // check for file attribute in current item 
    214                         if (_player.getPlaylistItem(evt.index) != null && _player.getPlaylistItem(evt.index)["related.file"] != undefined) { 
    215                                 url = _player.getPlaylistItem(evt.index)["related.file"]; 
    216                                 log("Found related.file on playlist item #" + evt.index + ": " + url); 
    217                         } 
    218                 } 
    219                 if (url == null) { 
    220                         url = _utils.getAbsolutePath(hwconf["file"]); 
    221                 } 
    222                 log("Loading related data from " + url); 
    223                 _utils.ajax(url, handleLoad, handleLoadError); 
    224         } 
    225  
    226         function handleLoad(xhr) { 
    227                 if (xhr) { 
    228                         var xml = xhr.responseXML; 
    229                         items = []; 
    230                         var nodes = _utils.find(xml, "item"); 
    231                         for (var i=0;i<nodes.length;i++) { 
    232                                 var node = nodes[i]; 
    233                                 if (node) { 
    234                                         var item = parseItem(node); 
    235                                         if (item != null) items.push(item); 
    236                                         packToPage(i, item); 
    237                                 } 
    238                         } 
    239                         packMissingThumbs(); 
    240                         loadPage(); 
    241                 } 
    242         } 
    243         function handleLoadError(xhr) { 
    244                 log("Failed to load file from '" + hwconf["file"] + "'"); 
    245         } 
    246  
    247         // local override of jwplayer.utils.find 
    248         // NB: browsers vary in handling of tags like "prefix:name" 
    249         function find(node, lbl) { 
    250                 var out = null; 
    251                 if (node != null) { 
    252                         var nlist = node.getElementsByTagName(lbl); 
    253                         if (nlist != null && nlist.length > 0) { 
    254                                 out = nlist.item(0); 
    255                         } 
    256  
    257                         if (out == null && lbl.indexOf(":") > -1) { 
    258                                 // try again with trimmed lbl, due to browser differences 
    259                                 var sh = lbl.substring(lbl.indexOf(":")+1); 
    260                                 nlist = node.getElementsByTagName(sh); 
    261                                 if (nlist.length > 0) { 
    262                                         out = nlist.item(0); 
    263                                 } 
    264                         } 
    265                 } 
    266                 return out; 
    267         } 
    268  
    269         function read(node) { 
    270                 var out = undefined; 
    271                 if (node) { 
    272                         // handle browser compatibility 
    273                         if (node.textContent != undefined) { 
    274                                 out = node.textContent; 
    275                         } else { 
    276                                 out = node.text; 
    277                         } 
    278                 } 
    279                 return out; 
    280         } 
    281  
    282         // local override of jwplayer.utils.strings.xmlAttribute 
    283         // NB: this version handles IE9 correctly by not using 'for in' notation 
    284         function xmlAttribute(xml, attribute) { 
    285                 var out = null; 
    286                 for (var a=0;a<xml.attributes.length;a++) { 
    287                         if (xml.attributes[a].name && xml.attributes[a].name.toLowerCase() == attribute.toLowerCase()) { 
    288                                 out = xml.attributes[a].value; 
    289                         } 
    290                 } 
    291                 return out; 
    292         } 
    293  
    294         function parseItem(node) { 
    295                 var item = null; 
    296                 if (node) { 
    297                         var title_node = find(node, "title"); 
    298                         var desc_node = find(node, "description"); 
    299                         var link_node = find(node, "link"); 
    300                         var thumb_node = find(node, "media:thumbnail"); 
    301                         var content_node = find(node, "media:content"); 
    302  
    303                         var item = {}; 
    304                         if (title_node) item["title"] = read(title_node); 
    305                         if (desc_node) item["description"] = read(desc_node); 
    306                         if (link_node) item["link"] = read(link_node); 
    307                         if (thumb_node) item["thumbnail"] = xmlAttribute(thumb_node, "url"); 
    308                         if (content_node) item["content"] = xmlAttribute(content_node, "url"); 
    309                 } 
    310                 return item; 
    311         } 
    312  
    313         function packToPage(i, item) { 
    314                 var page = null; 
    315                 if (item) { 
    316                         // pack to page 
    317                         var pg_no = Math.floor(i / items_per_page); 
    318                         if (pages.length <= pg_no) { 
    319                                 var pg = document.createElement("div"); 
    320                                 _utils.css(pg, { 
    321                                         "display"       : "none", 
    322                                         "position"      : "absolute", 
    323                                         "width"         : "260px", 
    324                                         "height"        : "180px" 
    325                                 }); 
    326                                 if (is_debug()) { 
    327                                         _utils.css(pg, { 
    328                                                 "width"                         : "258px", 
    329                                                 "height"                        : "178px", 
    330                                                 "border"                        : "1px dotted red", 
    331                                                 "backgroundColor"       : 0x101010 
    332                                         }); 
    333                                 } 
    334                                 pages.push(pg); 
    335                                 panel.appendChild(pg); 
    336                         } 
    337                         var page = pages[pg_no]; 
    338                         var position = page_positions[i % items_per_page]; 
    339                         if (position == null || position.length != 2) { 
    340                                 log("Error! Internal position map corrupted!"); 
    341                                 position = [0,0]; 
    342                         } 
    343                         var thumbnail = createThumb(item); 
    344                         _utils.css(thumbnail, { 
    345                                 "left"  : position[0], 
    346                                 "top"   : position[1] 
    347                         }); 
    348                         page.appendChild(thumbnail); 
    349                 } 
    350                 return page; 
    351         } 
    352  
    353         function packMissingThumbs() { 
    354                 var missing = items.length % items_per_page; 
    355                 var lastpage = pages[pages.length-1]; 
    356                 for (var i=missing;i>0;i--) { 
    357                         var position = page_positions[items_per_page - i]; 
    358                         if (position == null || position == undefined) { position = [0,0]; } 
    359                         var thumbnail = createThumb(); 
    360                         _utils.css(thumbnail, { 
    361                                 "left"  : position[0], 
    362                                 "top"   : position[1] 
    363                         }); 
    364                         lastpage.appendChild(thumbnail); 
    365                 } 
    366         } 
    367  
    368         function createThumb(item) { 
    369                 var thumbnail = document.createElement("div"); 
    370                 _utils.css(thumbnail, { 
    371                         "position"                      : "absolute", 
    372                         "zIndex"                        : "1", 
    373                         "cursor"                        : "pointer", 
    374                         "backgroundColor"       : 0x333333, 
    375                         "overflow"                      : "hidden", 
    376                         "border"                        : "1px solid 0x999999", 
    377                         "width"                         : 118, 
    378                         "height"                        : 78 
    379                 }); 
    380  
    381                 if (item) { 
    382                         var img = document.createElement("img"); 
    383                         if (item.thumbnail) img.src = item.thumbnail; 
    384                         _utils.css(img, { 
    385                                 "position"      : "absolute", 
    386                                 "zIndex"        : "3", 
    387                                 "width"         : 120, 
    388                                 "height"        : 80 
    389                         }); 
    390                         img.alt = item.title; 
    391                         img.title = item.description; 
    392                         thumbnail.appendChild(img); 
    393  
    394                         var title = document.createElement("div"); 
    395                         _utils.css(title, { 
    396                                 "position"                      : "absolute", 
    397                                 "zIndex"                        : "5", 
    398                                 "cursor"                        : "pointer", 
    399                                 "backgroundColor"       : 0x000000, 
    400                                 "opacity"                       : 0.5, 
    401                                 "overflow"                      : "hidden", 
    402                                 "fontFamily"            : "sans-serif", 
    403                                 "fontSize"                      : 11, 
    404                                 "textAlign"                     : "center", 
    405                                 "width"                         : 120, 
    406                                 "maxHeight"                     : 30, 
    407                                 "left"                          : 0, 
    408                                 "bottom"                        : 0 
    409                         }); 
    410                         title.innerHTML = item.title; 
    411                         thumbnail.appendChild(title); 
    412  
    413                         thumbnail.onclick = function(e) { 
    414                                 if (hwconf["redirect"]) { 
    415                                         log("Going to url " + item.link); 
    416                                         document.location = item.link; 
    417                                 } else { 
    418                                         log("Showing content " + item.content); 
    419                                         hide(); 
    420                                         _player.load(item.content); 
    421                                         _player.play(); 
    422                                 } 
    423                         }; 
    424                 } 
    425                 return thumbnail; 
    426         } 
    427  
    428         function loadPage(pg) { 
    429                 if (pg == undefined || pg == null || pg < 0) pg = 0; 
    430                 if (pg >= pages.length && pages.length > 0) { 
    431                         pg = pages.length - 1; 
    432                 } 
    433  
    434                 if (page_index == pg) { 
    435                         var page = pages[pg]; 
    436                         _utils.css(page, { 
    437                                 "display"       : "block", 
    438                                 "left"          : "30px", 
    439                                 "top"           : "40px" 
    440                         }); 
    441                 } else { 
    442                         log("Switching to thumbnail page #" + pg); 
    443                         switchPages(page_index, pg); 
    444                 } 
    445  
    446                 // bookkeeping 
    447                 page_index = pg; 
    448                 prevButton.style.display = (page_index == 0) ? "none" : "block"; 
    449                 nextButton.style.display = (page_index == pages.length - 1) ? "none" : "block"; 
    450         } 
    451          
    452         function switchPages(present, incoming) { 
    453                 var frame_interval = is_debug() ? 400 : 40; 
    454                 var frame_ct = 0; 
    455                 var frame_transposes    = [ 15,  45, 110, 175, 240, 260]; 
    456                 var frame_opacities     = [  1, 0.9, 0.8, 0.5, 0.3, 0]; 
    457                 var slide_direction     = present > incoming ? 1 : -1; 
    458  
    459                 var initial_pos = 30+(-slide_direction*260); 
    460  
    461                 var present_pane = pages[present]; 
    462                 _utils.css(present_pane, { 
    463                         "display"       : "block", 
    464                         "opacity"       : 1 
    465                 }); 
    466                 var incoming_pane = pages[incoming]; 
    467                 _utils.css(incoming_pane, { 
    468                         "display"       : "block", 
    469                         "opacity"       : 0, 
    470                         "left"          : initial_pos+"px", 
    471                         "top"           : "40px" 
    472                 }); 
    473  
    474                 slide_timer = setInterval(function() { 
    475                         var present_pane = pages[present]; 
    476                         var incoming_pane = pages[incoming]; 
    477                         if (frame_ct++ < frame_transposes.length) { 
    478                                 if (is_debug()) log("frame #" + frame_ct); 
    479                                 _utils.css(present_pane, { 
    480                                         "left"          : 30 + slide_direction*frame_transposes[frame_ct]+"px", 
    481                                         "opacity"       : frame_opacities[frame_ct] 
    482                                 }); 
    483                                 _utils.css(incoming_pane, { 
    484                                         "left"  : initial_pos + slide_direction*frame_transposes[frame_ct]+"px", 
    485                                         "opacity"       : 1-frame_opacities[frame_ct] 
    486                                 }); 
    487                         } else { 
    488                                 clearInterval(slide_timer); 
    489                                 _utils.css(present_pane, { 
    490                                         "display"       : "none" 
    491                                 }); 
    492                                 _utils.css(incoming_pane, { 
    493                                         "opacity"       : 1 
    494                                 }); 
    495                         } 
    496                 }, frame_interval); 
    497         } 
    498  
    499         // -------------------------------------------------------------------------------- 
    500         // external event handlers 
    501         // -------------------------------------------------------------------------------- 
    502         function handleJwResize(width, height) { 
    503  
    504                 if (_player.getFullscreen() == true) return; 
    505  
    506                 if (width < 320) { x = 0; } 
    507                 else { x = (width - 320) / 2; } 
    508                 if (height < 240) { y = 0; } 
    509                 else { y = (height - 240) / 2; } 
    510  
    511                 if (panel != null && backdrop != null) { 
    512                         _utils.css(panel, { 
    513                                 "position"      : "absolute", 
    514                                 "overflow"      : "hidden", 
    515                                 "top"           : y, 
    516                                 "left"          : x 
    517                         }); 
    518                         _utils.css(     backdrop, { 
    519                                 "width"         : width, 
    520                                 "height"        : height 
    521                         }); 
    522  
    523                         if (is_debug()) { 
    524                                 _utils.css(panel, { 
    525                                         "border"                        : "1px dotted gray", 
    526                                         "backgroundColor"       : 0xf000f0 
    527                                 }); 
    528                                 _utils.css(backdrop, { 
    529                                         "width"                         : width-2, 
    530                                         "height"                        : height-2, 
    531                                         "border"                        : "1px dotted yellow", 
    532                                         "backgroundColor"       : 0x00f0f0, 
    533                                         "opacity"                       : 0.5 
    534                                 }); 
    535                         } 
    536                 } 
    537         } 
    538         function handleJwComplete(e) { 
    539                 if (_player.getFullscreen() == true) return; 
    540                 show(); 
    541         } 
    542         function handleJwPause(e) { 
    543                 if (_player.getFullscreen() == true) return; 
    544                 if (e.oldstate == "PLAYING") { show(); } 
    545                 else { hide(); } 
    546         } 
    547         function handleDockButtonClick(e) { 
    548                 if (_player.getFullscreen() == true) return; 
    549                 if (canvas.style.display == "none") { 
    550                         _player.pause(true); 
    551                         show(); 
    552                 } else { 
    553                         hide(); 
    554                 } 
    555         } 
    556         function handleJwPlaylistItem(idx) { 
    557                 loadData(idx); 
    558         } 
    559  
    560         // -------------------------------------------------------------------------------- 
    561         // internal event handlers 
    562         // -------------------------------------------------------------------------------- 
    563         function handleClose(e) { 
    564                 hide(); 
    565         } 
    566         function handleReplay(e) { 
    567                 _player.seek(0); 
    568                 _player.play(true); 
    569                 hide(); 
    570         } 
    571         function handleNext(e) { 
    572                 loadPage(page_index+1); 
    573         } 
    574         function handlePrev(e) { 
    575                 loadPage(page_index-1); 
    576         } 
    577  
    578         // -------------------------------------------------------------------------------- 
    579         // utility functions 
    580         // -------------------------------------------------------------------------------- 
    581         function getImage(nm) { 
    582                 return "data:image/png;base64,"  + imageData[imageAssets[nm]]; 
    583         } 
    584  
    585         function is_debug() { 
    586                 return hwconf != null && Boolean(hwconf["uidebug"]) == true; 
    587         } 
    588  
    589         function log(msg) { 
    590                 _utils.log("Related: " + msg); 
    591         } 
    592  
    593         // -------------------------------------------------------------------------------- 
    594         // global functions 
    595         // -------------------------------------------------------------------------------- 
    596         this.show = function() { 
    597                 _player.getPlugin("controlbar").hide(); 
    598                 _player.getPlugin("dock").hide(); 
    599                 _player.getPlugin("display").hide(); 
    600                 canvas.style.display = "block"; 
    601         } 
    602  
    603         this.hide = function() { 
    604                 _player.getPlugin("controlbar").show(); 
    605                 _player.getPlugin("dock").show(); 
    606                 _player.getPlugin("display").show(); 
    607                 canvas.style.display = "none"; 
    608         } 
    609  
    610         // -------------------------------------------------------------------------------- 
    611         // standard plugin template 
    612         // -------------------------------------------------------------------------------- 
    613         var template = function(player, config, div) { 
    614                 _player = player; 
    615  
    616                 function setup(evt) { 
    617                         if (player.getRenderingMode() == "flash") { 
    618                                 log("Disabling Related JS plugin due to Flash player rendering mode."); 
    619                                 return; 
    620                         } else { 
    621                                 log("parsing configuration ... "); 
    622                                 loadConfig(player, config); 
    623  
    624                                 log("rendering canvas ..."); 
    625                                 renderCanvas(); 
    626                                 div.appendChild(canvas); 
    627                                 log("div: " + div.id) 
    628  
    629                                 log("registering event handlers ..."); 
    630                                 player.onPlaylistItem(handleJwPlaylistItem); 
    631                                 player.onComplete(handleJwComplete); 
    632  
    633                                 if (is_debug()) { 
    634                                         log(showconf()); 
    635                                 } else { 
    636                                         log(version() + " is ready."); 
    637                                 } 
    638                         } 
    639                 }; 
    640                 this.resize = handleJwResize; 
    641                 player.onReady(setup); 
    642         }; 
    643  
    644         var swfUrl = null; // "related-1h"; 
    645         jwplayer().registerPlugin("related", template, swfUrl); 
    646  
    647         var imageData = { 
    648           'relatedBack.png' : 'iVBORw0KGgoAAAANSUhEUgAAAUAAAADwCAYAAABxLb1rAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAs5JREFUeNrs3LENwkAUREEO0atrotozJdhCiNu9mRgROHja4NtjzvkA2NEQQEAAAQQQQAABBBBAAAEEEEAAAfYN4BjDUwT+4ut+Xf2DT+jeHjcQEsbjyu+eHhWwKwEEBBBAAAEEEEAAAQQQQAABCrxu/NYrH4AFCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAA/52MIgAUIIIAAAggggAACCCCAAAIIIIAAAggggACL8yocYAECCCCAAAIIIIAAAggggAACCCBAHIfQgAUIIIAAAggggAACCCCAAAIIIIAAcRxCAxYggAACCCCAAAIIIIAAAggggAACxHEIDViAAAIIIIAAAggggAACCCCAALncAQIWIIAAAggggAACCCCAAAIIIEAud4CABQgggAACCCCAAAIIIIAABZzBABYggAACCCCAAAIIIIAAAhRwBgNYgAACCCCAAAIIIIAAAggggAC53AECFiCAAAIIIIAAAggggAACFHAGA1iAAAIIIIAAAggggAACCFDAGQxgAQIIIIAAAggggAACCCBAAWcwgAUIIIAAAggggAACCCCAAAWcwQAWIIAAAggggAACCCCAAAIUcAYDWIAAAggggAACCCCAAAIIIIAAudwBAhYggAACCCCAAAIIIIAAAhRwBgNYgAACCCCAAAIIIIAAAghQwBkMYAECCCCAAAIIIIAAAggggAAC5HIHCFiAAAIIIIAAAggggAACCCCAALncAQIWIIAAAggggAACCCCAAAIIIIAAAsRxCA1YgAACCCCAAAIIIIAAAggggAACCBDHITRgAQIIIIAAAggggAACCCCAAAIIIEAch9CABQgggAACCCCAAAIIIIAAAggggAACCCCAAIvzKhxgAQIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCDAUnwMAbAAAQQQQAABBBBAAAEEEEAAAXKdAgwAPU0qAzOcfUoAAAAASUVORK5CYII=', 
    649           'relatedButton.png' : 'iVBORw0KGgoAAAANSUhEUgAAAA8AAAAKCAYAAABrGwT5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMxJREFUeNqkkrENwjAQRS+eAUVKJBZIGySKDECF3KQjYgCWSHZBFNB5iKxBg0iB2MH8g3/CSpuTns5+d7acU7IYo2QIETkADxr5xQjeYDVzAVxwLjoe7MEOXEENNiDSRe5r1tX1PCcdOINcX6Ek7sTcJbXcnONTAwov+Ye6J3gweyuwL5ibQGE383Z1R7Bnnmb1Qp2TBeE4wWbm1VVcV9ynof2js/djeHlSVLcFa+ZgBfZ5czrygRNs+T0luIE7c0nfsm/43rPkJ/kIMABziF/lvV83qQAAAABJRU5ErkJggg==', 
    650           'relatedClose.png' : 'iVBORw0KGgoAAAANSUhEUgAAAB4AAAAoCAYAAADpE0oSAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4RJREFUeNrsVs1LG0EUf7NJGsVibTEtYgyiIL2ENNabBaH4ESIYxL+glIK3gigoekhp1UOPlkLB0qNHIyqCSLExWC9NEfXYiPjVWDFpbE1ck92+N8yWjVjqpgcP3YEfu/P2zfu9r5lZpqoqXMWQ4IrGpYkZY3nQjfuIF4gPiCxCRrxHPEO4/2iQUn0ZXOQLysfVv49xoZtnj122xueiZIqizKDMf3Z2BlNTU7C0tARra2tgsVjA7XZDU1MT+P1+sNlsRDQtSVJA1ZEVQsyy2exbJHgUj8dhYGAAYrHYhWvq6upgZGQEysvLIZfLvbNarY81cqPNxVKpVCORUqREmkgkoKurK0+prKwMOjs7uUP9/f1AurQGdT1Mi8BAjWmBRZblN+T1xMSEiulU5+bmeCEx3Xzu8/nUaDTKZWNjY1wWCoX4P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AAANSUhEUgAAAHgAAABQCAYAAADSm7GJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKVJREFUeNrs1MEJACAMBMGL2H/L0actGGZB8H2DVpKOxrZMMLv93Msco2ov2BctwAIswAIswAIMWIAFWIAFWIAFGLAAC7AAC7AAC7AAAxZgARZgARZgAQYswAIswAIswAIM2ASABViABViABViAAQuwAAuwAAuwAAMWYAEWYAEWYAEWYMACLMACLMACLMCABViABViABViAAWtsdU+bwQvWpx0BBgDotgOfrnYXOQAAAABJRU5ErkJggg==', 
    656           'relatedThumbOverlayOver.png' : 'iVBORw0KGgoAAAANSUhEUgAAAHgAAABQCAYAAADSm7GJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdBJREFUeNrs3OFtGkEQQGGI+B9KcAchFZhUkCvBJbgEXIFJBXE6IBWEEijB7oBUQHajQRmtEkIUydKuvieN4GbnTmgfc7eHxM1PhRmG5Y0pGJtFej83HUNx0sFO0SAYBINgEAyCQTDBIBgEg2AQDIJBMMEgGASDYBAMgkEwCCYYBINgEAyCQTAIJhgEg2AQ/N+sSuybeCqxbsZXF46xjprpL7nKMvKb3iZq0angOuG3Jb6UeI5clfKtxIfYvo26P3GXanaR28dr/bLclDim7VXs0xenX8w6inV85nWTP5bYXBg/xzJqt1G3SmM3MbaL7Slqps7m6CcjXYNrx71NXXeJKWrrKfelxH0ae478x6jblviaulwHv2IHH0rsI84sr+jgQ+rQTdov15yPefzNmA5+ZWrXPpR4f0UH105/lxZiU7omt9fo8+ux14lZdC72Pi2M/mWf77FwavPb5lQ961nuCIKvuZ3KHKIjd80tT5X5Od0mDcPogh+b7U+xuNo2+afI3Y0meJ4eRupRhmPhUYZ+qgTBIBgEg2AQDIIJBsEgGASDYBAMggkGwSAYBINgEAyCQTDBIBgEg2AQDIJBMMEgGJ2R/+F/Mh06GJ3xQ4ABAIVjJoZ0UeJ1AAAAAElFTkSuQmCC' 
    657         }; 
     15    /** Register the plugin with JW Player. **/ 
     16    jwplayer().registerPlugin('related', template,'./related.swf'); 
    65817 
    65918 
  • plugins/related/test/assets/playlist.xml

    r1784 r1938  
    11<rss version="2.0" xmlns:jwplayer="http://developer.longtailvideo.com/trac/wiki/FlashFormats"> 
    22        <channel> 
    3                 <title>Example RSS playlist with sharing, related</title> 
    43 
    54                <item> 
    6                         <title>Big Buck Bunny</title> 
    7                         <description>This entry has both an embed code and a share link defined in the playlist.</description> 
    8                         <enclosure url="http://content.bitsontherun.com/videos/nPripu9l-327.mp4" /> 
    9                         <jwplayer:related.file>assets/recs.xml</jwplayer:related.file> 
    10                         <jwplayer:sharing.link>http://www.longtailvideo.com</jwplayer:sharing.link> 
    11                         <jwplayer:sharing.code><![CDATA[<embed src="http://video.longtailvideo.com/players/nPripu9l-ALJ3XQCI.swf" width="480" height="270" allowfullscreen="true" />]]></jwplayer:sharing.code> 
     5                        <title>Big Buck Bunny Trailer</title> 
     6                        <description>This entry has a feed with 3 related videos.</description> 
     7                        <jwplayer:file>http://content.bitsontherun.com/videos/nPripu9l-327.mp4</jwplayer:file> 
     8                        <jwplayer:image>http://content.bitsontherun.com/thumbs/nPripu9l-320.jpg</jwplayer:image> 
     9                        <jwplayer:related.file>assets/blender.xml</jwplayer:related.file> 
    1210                </item> 
    1311 
    1412                <item> 
    15                         <title>Big Buck Bunny</title> 
    16                         <description>This entry has no code defined, so the plugin uses the embed code of the current player.</description> 
    17                         <enclosure url="http://content.bitsontherun.com/videos/nPripu9l-327.mp4" /> 
    18                         <jwplayer:related.file>assets/recommendations.xml</jwplayer:related.file> 
    19                         <jwplayer:sharing.link>http://www.longtailvideo.com</jwplayer:sharing.link> 
     13                        <title>Bits on the Run intro</title> 
     14                        <description>This entry has a feed with 5 related videos.</description> 
     15                        <jwplayer:file>http://content.bitsontherun.com/videos/yYul4DRz-327.mp4</jwplayer:file> 
     16                        <jwplayer:image>http://content.bitsontherun.com/thumbs/yYul4DRz-320.jpg</jwplayer:image> 
     17                        <jwplayer:related.file>assets/screencasts.xml</jwplayer:related.file> 
    2018                </item> 
    2119 
    2220                <item> 
    23                         <title>Big Buck Bunny</title> 
    24                         <description>This entry has no link defined, so the plugin uses the link to the current page.</description> 
    25                         <enclosure url="http://content.bitsontherun.com/videos/nPripu9l-327.mp4" /> 
    26                         <jwplayer:related.file>assets/recommendations.xml</jwplayer:related.file> 
    27                         <jwplayer:sharing.code><![CDATA[<embed src="http://video.longtailvideo.com/players/nPripu9l-ALJ3XQCI.swf" width="480" height="270" allowfullscreen="true" />]]></jwplayer:sharing.code> 
     21                        <title>Coronation street</title> 
     22                        <description>This entry has no related videos.</description> 
     23                        <jwplayer:file>http://content.bitsontherun.com/videos/JUsVgTHL-327.mp4</jwplayer:file> 
     24                        <jwplayer:image>http://content.bitsontherun.com/thumbs/JUsVgTHL-320.jpg</jwplayer:image> 
    2825                </item> 
    2926 
    3027                <item> 
    31                         <title>Big Buck Bunny</title> 
    32                         <description>This entry has neither an embed code nor a share link.</description> 
    33                         <enclosure url="http://content.bitsontherun.com/videos/nPripu9l-327.mp4" /> 
    34                         <jwplayer:related.file>assets/recs.xml</jwplayer:related.file> 
     28                        <title>Men With Talent</title> 
     29                        <description>This entry has a feed with 25 related videos.</description> 
     30                        <jwplayer:file>http://content.bitsontherun.com/videos/TnoZfafq-327.mp4</jwplayer:file> 
     31                        <jwplayer:image>http://content.bitsontherun.com/thumbs/TnoZfafq-320.jpg</jwplayer:image> 
     32                        <jwplayer:related.file>assets/heineken.xml</jwplayer:related.file> 
    3533                </item> 
    3634 
  • plugins/related/test/basic.html

    r1930 r1938  
    2626    plugins: { 
    2727        '../related.js': { 
    28             file: 'assets/related.xml' 
     28            file: 'assets/blender.xml' 
    2929        } 
    3030    }, 
  • plugins/related/test/compatibility.html

    r1937 r1938  
    11<html> 
    2         <head> 
    3                 <script src="./assets/jwplayer.js" type="text/javascript"></script> 
    4         </head> 
    5         <body> 
    6                 <a href="index.html">Back to index</a> 
    7                 <div id="player"></div> 
    8                 <script type="text/javascript"> 
    9                 jwplayer('player').setup({ 
    10                         levels: [ 
    11                                 { file: './assets/bunny.flv' } 
    12                         ], 
    13                         plugins: { 
    14                                 '../bin-debug/related.js': { 
    15                                         useicons: true, 
    16                                         file: "./assets/recs.xml" 
    17                                 } 
    18                         }, 
    19                         'modes': [ 
    20                                 {type: 'flash', src: './assets/player.swf'} 
    21                         ] 
    22                 }); 
    23                 </script> 
    24         NB: Plugin will not load here, due to Flash player mode. 
    25         </body> 
     2<head> 
     3 
     4<meta charset="UTF-8"> 
     5<script type="text/javascript" src="assets/swfobject.js"></script> 
     6<title>Backward compatibility</title> 
     7<style> 
     8    body { padding: 50px; font: 13px/20px Arial; background: #EEE; } 
     9    #player, p, ul { margin-top: 20px; display: block; } 
     10    #player { -webkit-box-shadow: 0 0 5px #999; background: #000; color:#FFF; line-height:270px; text-align: center; } 
     11</style> 
     12 
     13</head> 
     14<body> 
     15 
     16<h2>Backward compatibility</h2> 
     17 
     18<div id="player">Select an option</div> 
     19 
     20<script type="text/javascript"> 
     21    swfobject.embedSWF( 
     22        'assets/player-5.2.swf', 
     23        'player', 
     24        720, 
     25        294, 
     26        '9.0.0', 
     27        null, 
     28        {file:'assets/playlist.xml', playlist: 'right', playlistsize: 240, plugins:'../related.swf', 'related.heading':'Check out these vids too:'}, 
     29        {allowfullscreen:'true',allowscriptaccess:'always'}, 
     30        {id:'player',name:'player'} 
     31    ); 
     32</script> 
     33 
     34<p> 
     35    This test uses the 5.2 player and the SWFObject embed method.<br /> 
     36    All related features are enabled: useicons, oncomplete, heading and playlisting. 
     37</p> 
     38 
     39</body> 
    2640</html> 
    27  
  • plugins/related/test/index.html

    r1930 r1938  
    2020<ul> 
    2121    <li><a href="playlist.html">Playlist support</a></li> 
    22     <li><a href="recursion.html">Recursive related</a></li> 
    2322    <li><a href="dimensions.html">Various Dimensions</a></li> 
    2423</ul> 
  • plugins/related/test/options.html

    r1937 r1938  
    11<html> 
    2         <head> 
    3                 <script src="./assets/jwplayer.js" type="text/javascript"></script> 
    4         </head> 
    5         <body> 
    6                 <a href="index.html">Back to index</a> 
    7                 <div id="player"></div> 
    8                 <script type="text/javascript"> 
    9                 jwplayer('player').setup({ 
    10                         levels: [ 
    11                                 { file: 'http://playertest.longtailvideo.com/bunny.mp4' }, 
    12                                 { file: 'http://playertest.longtailvideo.com/bunny.ogv' } 
    13                         ], 
    14                         plugins: { 
    15                                 '../bin-debug/related.js': { 
    16                         useicons: true, 
    17                         onpause: false, 
    18                         redirect: false, 
    19                         uidebug: true, 
    20                         file: "./assets/recs.xml" 
    21                                 } 
    22                         }, 
    23                         'modes': [ 
    24                                 {type: 'html5'}, 
    25                                 {type: 'flash', src: './assets/player.swf'} 
    26                         ] 
    27                 }); 
    28                 </script> 
    29         NB: this example uses an undocumented flag <tt>uidebug</tt> to show the UI layout. 
    30         </body> 
     2<head> 
     3 
     4<meta charset="UTF-8"> 
     5<script type="text/javascript" src="assets/jwplayer.min.js"></script> 
     6<title>Configuration options</title> 
     7<style> 
     8    body { padding: 50px; font: 13px/20px Arial; background: #EEE; } 
     9    #player, p, ul { margin-top: 20px; display: block; } 
     10    #player { -webkit-box-shadow: 0 0 5px #999; } 
     11</style> 
     12 
     13</head> 
     14<body> 
     15 
     16<h2>Configuration options</h2> 
     17 
     18<div id="player"></div> 
     19 
     20<script type="text/javascript"> 
     21function reload(oncomplete,usedock,heading) { 
     22    jwplayer("player").setup({ 
     23        file: 'http://content.bitsontherun.com/videos/nPripu9l-327.mp4', 
     24        flashplayer: 'assets/player.swf', 
     25        height: 270, 
     26        image:'http://content.bitsontherun.com/thumbs/nPripu9l-480.jpg', 
     27        plugins: { 
     28            '../related.js': { 
     29                file: 'assets/blender.xml', 
     30                oncomplete: oncomplete, 
     31                usedock: usedock, 
     32                heading: heading 
     33            } 
     34        }, 
     35        width: 480 
     36    }); 
     37}; 
     38</script> 
     39 
     40 
     41<ul> 
     42    <li><a href="javascript:reload(true,true,'Watch related videos');">Default options</a></li> 
     43    <li><a href="javascript:reload(false,true,'Watch some additional related videos');">Oncomplete disabled, long heading</a></li> 
     44    <li><a href="javascript:reload(true,false,'لوحة ال٠
     45فاتيح العرؚية');">Usedock disabled, arab heading</a></li> 
     46</ul> 
     47 
     48 
     49<p> 
     50    The oncomplete option (true/false) determines whether related thumbs are shown at the end of the video.<br /> 
     51    The usedock option (true/false) determines whether a related dock button is shown.<br/> 
     52    A custom heading replaces the default <em>Watch more videos</em>. 
     53</p> 
     54 
     55 
     56</body> 
    3157</html> 
    32  
  • plugins/related/test/playlist.html

    r1930 r1938  
    11<html> 
    2         <head> 
    3                 <script src="./assets/jwplayer.js" type="text/javascript"></script> 
    4         </head> 
    5         <body> 
    6                 <a href="index.html">Back to index</a> 
    7                 <div id="player"></div> 
    8                 <script type="text/javascript"> 
    9                 jwplayer('player').setup({ 
    10                         playlist: [  
    11                                 {  
    12                                         levels: [ 
    13                                                 { file: 'http://playertest.longtailvideo.com/bunny.mp4' }, 
    14                                                 { file: 'http://playertest.longtailvideo.com/bunny.ogv' } 
    15                                         ], 
    16                                         'related.file': './assets/bunnies.xml' 
    17                                 }  
    18                         ], 
    19                         plugins: { 
    20                                 '../bin-debug/related.js': { 
    21                                         useicons: true, 
    22                                         file: "./assets/recs.xml" 
    23                                 } 
    24                         }, 
    25                         'modes': [ 
    26                                 {type: 'html5'}, 
    27                                 {type: 'flash', src: './assets/player.swf'} 
    28                         ] 
    29                 }); 
    30                 </script> 
    31         </body> 
     2<head> 
     3 
     4<meta charset="UTF-8"> 
     5<script type="text/javascript" src="assets/jwplayer.min.js"></script> 
     6<title>Playlist support</title> 
     7<style> 
     8    body { padding: 50px; font: 13px/20px Arial; background: #EEE; } 
     9    #player, p, ul { margin-top: 20px; display: block; } 
     10    #player { -webkit-box-shadow: 0 0 5px #999; } 
     11</style> 
     12 
     13</head> 
     14<body> 
     15 
     16<h2>Playlist support</h2> 
     17 
     18<div id="player"></div> 
     19<script type="text/javascript"> 
     20function loadPlaylist(list,html5) {  
     21    var options = { 
     22        height: 360, 
     23        'playlist.position': 'right', 
     24        'playlist.size': 240, 
     25        plugins: { '../related.js': {} }, 
     26        width: 880 
     27    }; 
     28    if(typeof(list) == 'string') {  
     29        options.file = list; 
     30    } else { 
     31        options.playlist = list; 
     32    } 
     33    if(html5) {  
     34        options.modes = [{type: 'html5'},{type:'flash',src:'assets/player.swf'}]; 
     35    } else {  
     36        options.modes = [{type:'flash',src:'assets/player.swf'},{type: 'html5'}]; 
     37    } 
     38    jwplayer("player").setup(options); 
     39}; 
     40 
     41var externalList = 'assets/playlist.xml'; 
     42var inlineList = [{ 
     43    title: 'Big Buck Bunny Trailer', 
     44    description: 'This entry has a feed with 3 related videos.', 
     45    file: 'http://content.bitsontherun.com/videos/nPripu9l-327.mp4', 
     46    image: 'http://content.bitsontherun.com/thumbs/nPripu9l-320.jpg', 
     47    'related.file': 'assets/blender.xml' 
     48},{ 
     49    title: 'Bits on the Run intro', 
     50    description: 'This entry has a feed with five related videos.', 
     51    file: 'http://content.bitsontherun.com/videos/yYul4DRz-327.mp4', 
     52    image: 'http://content.bitsontherun.com/thumbs/yYul4DRz-320.jpg', 
     53    'related.file': 'assets/screencasts.xml' 
     54},{ 
     55    title: 'Coronation street', 
     56    description: 'This entry has no related videos.', 
     57    file: 'http://content.bitsontherun.com/videos/JUsVgTHL-327.mp4', 
     58    image: 'http://content.bitsontherun.com/thumbs/JUsVgTHL-320.jpg' 
     59},{ 
     60    title: 'Men With Talent', 
     61    description: 'This entry has a feed with 25 related videos.', 
     62    file: 'http://content.bitsontherun.com/videos/TnoZfafq-327.mp4', 
     63    image: 'http://content.bitsontherun.com/thumbs/TnoZfafq-320.jpg', 
     64    'related.file':'assets/heineken.xml' 
     65}]; 
     66</script> 
     67 
     68 
     69<ul> 
     70    <li><a href="javascript:loadPlaylist(externalList,true)">RSS in HTML5</a></li> 
     71    <li><a href="javascript:loadPlaylist(inlineList,true)">Inline in HTML5</a></li> 
     72    <li><a href="javascript:loadPlaylist(externalList,false)">RSS in Flash</a></li> 
     73    <li><a href="javascript:loadPlaylist(inlineList,false)">Inline in Flash</a></li> 
     74</ul> 
     75 
     76 
     77<p>3 playlistitems have related videos, 1 not.<br /> 
     78   The player should show the correct related videos for all entry.<br/> 
     79   Without related videos, the dock button should grey out and the oncomplete not pop up. 
     80</p> 
     81 
     82 
     83</body> 
    3284</html> 
Note: See TracChangeset for help on using the changeset viewer.