2012-01-27 12 views
0

https://developers.google.com/tv/web/docs/gtv-templates#template2にあるHTML5 Google TVテンプレート2を使用するウェブページを設定しようとしています。私は失われていますが、テンプレートはサムネイルIDをランダム化するためです(何らかの奇妙な理由で)。サムネイルIDをランダム化してGoogle TVテンプレートを停止する

私は11のビデオを持っており、それぞれのビデオを特定のサムネイルにつなぎたいと思っています。助言がありますか?

http://pastebin.com/L2U54DPZには、テンプレートに電源を供給する「dataprovider.js」があります。どんな助けでも大歓迎です。ありがとう

答えて

1

オンライン46変更: var num = getRandom(15); 〜 var num =小;

オンライン上の変更: var videoInfo = sources [getRandom(sources.length)]; 〜 var videoInfo = sources [j];

thumb: 'images/thumbs/thumb' + getThumbId() + '.jpg', 

に親指:ライン170変更で

'画像/親指/親指' + getThumbId(J)+ '.JPG'、

+0

:ここ

が変更されたバージョンは、次のようになります。すべてのサムネイルと動画の読み込みが終了しました – ace973

+0

今修正されていない場合は、誰かにライブラリのコードを修正するよう依頼します。 –

+0

ありがとうLesは働いた。他の人へのジャスタの速報:あなたが異なる数のビデオを持っている場合は、ライン167を調整する必要があります。私は11のビデオを持っているので(var j = 0; j <11; j ++) – ace973

0

Googleの例があることに注意してください機能性を説明する。 私はランダムが入ってくる場所だと思っています。彼らは例のためのデータを生成しています。

私はdataprovider.jsをより理解しやすくするように変更しました。うまくいかなかったこと残念ながら

var gtv = gtv || { 
    jq: {} 
}; 

/** 
* DataProvider class. Defines a provider for all data (Categories, Images & Videos) shown in the template. 
*/ 
gtv.jq.DataProvider = function() { 
}; 

/** 
* Returns all data shown in the template.. 
* @return {object} with the following structure: 
* - categories -> [category1, category2, ..., categoryN]. 
* - category -> {name, videos}. 
* - videos -> {thumb, title, subtitle, description, sources} 
* - sources -> [source1, source2, ..., sourceN] 
* - source -> string with the url | {src, type, codecs} 
*/ 
gtv.jq.DataProvider.prototype.getData = function() { 
    var event_videos = [ 
    { 
     sources: ['http://commondatastorage.googleapis.com/gtv_template_assets/IO2010-Keynote-day1.mp4'], 
     title: '2010 Day 1 Keynote', 
     thumb: 'images/thumbs/thumb01.jpg', 
     description: ['With Vic Gundotra'], 
     subtitle: 'Moscone Center' 
    }, 
    { 
     sources:['http://commondatastorage.googleapis.com/gtv_template_assets/IO2010-Keynote-day2-android.mp4'], 
     title: '2010 Day 2 Keynote', 
     thumb: 'images/thumbs/thumb02.jpg', 
     description: ['Spider - what spider?'], 
     subtitle: 'Moscone Center' 
    } 
]; 

var buck_videos = [ 
    { 
     sources:['http://bffmedia.com/trailer_400p.ogg'], 
     title: 'Big Buck 400p Video Trailer', 
     thumb: 'http://www.bffmedia.com/buck1.png', 
     description: ['Common Creative Project Movie'], 
     subtitle: 'Smaller Version' 
    }, 
    { 
     sources:['http://bffmedia.com/trailer_1080p.ogg'], 
     title: 'Big Buck 1080p Video Trailer', 
     thumb: 'http://www.bffmedia.com/buck2.png', 
     description:['Common Creative Project Movie'], 
     subtitle: 'Big Buck is a Rabbit' 
    } 
]; 



var data = { 
    categories: [ 
    { 
     name: 'Dev Events', 
     videos: event_videos 
    }, 
    { 
     name: 'Big Buck', 
     videos: buck_videos 
    } 
    ] 
}; 
    return data; 
}; 
関連する問題