web/player_embed.php
author Raphael Velt <raph.velt@gmail.com>
Mon, 21 May 2012 18:18:08 +0200
changeset 620 953c68b4da79
parent 535 8276f3ff7a3f
child 621 44f90de0016f
permissions -rw-r--r--
Added Edito 24.05 + embed code now relaying mediafragment

<?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.libFiles.defaultDir = "<?php echo(registry_url('libdir','js'));?>";
    IriSP.widgetsDir = "<?php echo(registry_url('ldtwidgets','js'));?>";
    IriSP.jwplayer_swf_path = "<?php echo(URL_ROOT); ?>res/mediaplayer/player.swf";
    IriSP.language = "<?php echo($actual) ?>";
    
    var _metadata = {
        url: metadatas[metadata_key].url + '?callback=?',
        format: 'ldt'
    };
    var _config = {            
        gui: {
            width: 630,
            container: 'LdtPlayer',
            default_options: {
                metadata: _metadata
            },
            css:'<?php echo(registry_url('metadataplayer','css'));?>',
            widgets: [
                { type: "Polemic" },
                { type: "Slider" },
                {
                    type: "Controller",
                    disable_annotate_btn: true
                },
                { type: "Segments" },
                { type: "Arrow" },
                { type: "Annotation" },
                { type: "Tweet" },
                { type: "Mediafragment"}
            ]
        },
        player:{
            type:'jwplayer', // player type
            live: true, 
            height: 300, 
            width: 630, 
            provider: "rtmp",
            autostart: true
        }
    };
    </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;
		}
    	#LdtPlayer {
    	    margin-bottom: 2px;
    	}
	</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">
    var _myPlayer = new IriSP.Metadataplayer(_config, _metadata);
</script>
  </body>
</html>