front_idill/src/player/metadataplayer/TabletPlayButton.js
author bastiena
Mon, 24 Sep 2012 15:19:49 +0200
changeset 123 57a65edde708
parent 79 9eff85166868
permissions -rw-r--r--
Front IDILL: non tmpl config files removed.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
79
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
     1
/*
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
     2
* This file is part of the TraKERS\Front IDILL package.
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
     3
*
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
     4
* (c) IRI <http://www.iri.centrepompidou.fr/>
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
     5
*
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
     6
* For the full copyright and license information, please view the LICENSE
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
     7
* file that was distributed with this source code.
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
     8
*/
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
     9
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    10
/*
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    11
 * Projet : TraKERS
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    12
 * Module : Front IDILL
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    13
 * Fichier : TabletPlayButton.js
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    14
 * 
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    15
 * Auteur : alexandre.bastien@iri.centrepompidou.fr
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    16
 * 
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    17
 * Fonctionnalités : Widget du bouton de lecture du player incorporé dans le Front pour le mode d'interaction pour tablettes.
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    18
 */
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    19
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    20
/*
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    21
 Ce Widget se superpose à la vidéo.
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    22
 * Est appelé dans les fichiers créant les widgets du metadataplayer.
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    23
 */
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    24
IriSP.Widgets.TabletPlayButton = function(player, config)
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    25
{
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    26
    IriSP.Widgets.Widget.call(this, player, config);
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    27
    // this.bindPopcorn("loadedmetadata","ready");
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    28
    this.paused = true;
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    29
    this.player = player;
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    30
    this.buttonWidth = 85;
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    31
    this.buttonHeight = 69;
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    32
};
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    33
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    34
/*
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    35
 * Constructeur du Widget.
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    36
*/
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    37
IriSP.Widgets.TabletPlayButton.prototype = new IriSP.Widgets.Widget();
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    38
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    39
/*
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    40
 * Fonction appelée pour dessiner le bouton.
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    41
*/
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    42
IriSP.Widgets.TabletPlayButton.prototype.draw = function()
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    43
{
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    44
    this.$playButton = IriSP.jQuery('<div>').attr("id", "tabletPlayButton");
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    45
    
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    46
    //On l'ajoute au widget.
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    47
    this.$.append(this.$playButton);
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    48
    this.$playButton.css(
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    49
    {
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    50
        position: 'absolute',
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    51
        width: this.player.config.gui.width,
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    52
        height: this.player.config.gui.height,
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    53
        'margin-top': -this.player.config.gui.height,
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    54
        'background-position': ((this.player.config.gui.width - this.buttonWidth)/2) + 'px ' + ((this.player.config.gui.height - this.buttonHeight)/2) + 'px'
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    55
    });
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    56
};
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    57
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    58
/*
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    59
 * Fonction appelée pour dessiner le bouton.
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    60
*/
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    61
IriSP.Widgets.TabletPlayButton.prototype.onPlayButtonTouchStart = function()
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    62
{
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    63
    if(this.paused)
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    64
    {
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    65
        this.paused = false;
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    66
        
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    67
        this.$playButton.css('opacity', '0');
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    68
        this.player.popcorn.play();
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    69
    }
9eff85166868 Front IDILL :
bastiena
parents:
diff changeset
    70
}