web/player_embed.php
author Raphael Velt <raph.velt@gmail.com>
Fri, 04 May 2012 09:44:41 +0200
changeset 601 68fea6b83600
parent 535 8276f3ff7a3f
child 620 953c68b4da79
permissions -rw-r--r--
Added tag V01.74 for changeset be4f99c03208

<?php

/**
 * include some common code (like we did in the 90s)
 * People still do this? ;)
 */
$rep = $_REQUEST['rep'];
include_once dirname(__FILE__).'/'.$rep.'/config.php';
// configuration
include 'common.php';

// todo :
// - gestion du parent.document.location mediafragment
// - limite taille vertical embed
// - ajouter la polemic timline en dessous de la video

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Polemic Tweet Embedded Player</title>
    <script type="text/javascript" src="<?php echo(registry_url('json-js','js'));?>"></script>
    <script type="text/javascript" src="<?php echo(registry_url('jquery','js'));?>"></script>
    <script type="text/javascript">
        $.noConflict();
    </script>
    <script type="text/javascript" src="<?php echo(registry_url('jquery-url','js'));?>"></script>
    <script type="text/javascript" src="<?php echo(registry_url('metadataplayer','js'));?>"></script>
        
    
    <!-- FONT -->
    <link href='<?php echo(registry_url('PT-Sans_Narrow','font'));?>' rel='stylesheet' type='text/css'/>
    <link href='<?php echo(registry_url('PT-Sans','font'));?>' rel='stylesheet' type='text/css'/>
    
    
    <script type="text/javascript">
        // Configuration Polemical Timeline
        if (typeof jQuery == "undefined") {
            jQuery = IriSP.jQuery;
        }
        <?php
            if(is_array($translate->_('config__metadata'))):
            reset($translate->_('config__metadata'));
            $first_key = key($translate->_('config__metadata'));
        ?>
        var metadatas = jQuery.parseJSON('<?php echo(json_encode($translate->_('config__metadata'))); ?>');
        var url = jQuery.url();
        var metadata_key = url.fparam('metadata');
        if(typeof metadata_key === "undefined" || metadata_key.length === 0) {
            metadata_key = "<?php echo($first_key);?>";
        }
        <?php else: ?>
        var metadatas = { metadata: {url: "<?php echo($translate->_('config__metadata'));?>", duration: <?php echo($translate->_('config__duration'))?>} };
        var metadata_key = "metadata";
        <?php endif;?>
    IriSP.libdir = "<?php echo(registry_url('libdir','js'));?>";
    IriSP.jwplayer_swf_path = "<?php echo(URL_ROOT); ?>res/mediaplayer/player.swf";
    IriSP.platform_url = "http://ldt.iri.centrepompidou.fr/";
    var json_url = metadatas[metadata_key].url;

    var config = {            
        gui:{
            width:650,
            height:800,              
            container:'LdtPlayer',
            css:'<?php echo(registry_url('metadataplayer','css'));?>',
            default_options : {
                metadata:{
                format:'cinelab',
                src: json_url,
                type:'json'},
                width: 650
            },
            widgets: [
            {type: "PolemicWidget",
               requires: [{
                type: "TooltipWidget",
                width: 180,
                height: 160,
                metadata : {type:'empty'
                }
               }],
               height: 75
            },
            {type: "SliderWidget"},        
            {type: "PlayerWidget", // please note that type refers directly to the constructor of the widget.
             mode: "radio"},
            {type: "SegmentsWidget",
             requires: [{
              type: "TooltipWidget",
              width: 180,
              height: 160,
              }],
                width: 650
            },                      
            {type: "ArrowWidget"},
            {type: "TweetsWidget"},
            {type: "AnnotationsWidget"}
            ]
        },
      player:{
          type:'jwplayer',
          live: true, 
          height: 400, 
          width: 650, 
          provider: "rtmp" 
      },
      modules: [
               { type: "MediaFragment",
                         metadata:{
                       format:'cinelab',
                           src:json_url,
                             type:'json'}
                        }]

    };
    </script>
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-23581291-1']);
        _gaq.push(['_trackPageview', location.pathname + location.search + location.hash]);
        _gaq.push(['_setAllowAnchor', true]);
      
        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();
    </script>
	<style type="text/css">
		body{
			padding:0px;
			margin:0px;
		}

	</style>
	<script type="text/javascript">
		var _gaq = _gaq || [];
		_gaq.push(['_setAccount', 'UA-23581291-1']);
		_gaq.push(['_trackPageview', location.pathname + location.search + location.hash]);
		_gaq.push(['_setAllowAnchor', true]);
	  
		(function() {
		    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		})();
	</script>
  </head>
  
        <div id="LdtPlayer"></div>
<script type="text/javascript">
    IriSP.initPlayer(config, json_url);
</script>
  </body>
</html>