web/player_embed.php
author Raphael Velt <raph.velt@gmail.com>
Tue, 28 Aug 2012 12:29:30 +0200
changeset 685 b48fe0f2d5b1
parent 684 f59daf0830d2
child 694 e9400c80e1e4
permissions -rw-r--r--
Removed Protocol on FENS 2012

<?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

if (is_array($config['metadata'])) {
    if (array_key_exists("metadata",$_GET) && array_key_exists($_GET['metadata'], $config['metadata'])) {
        $metadata_url = $config['metadata'][$_GET['metadata']]['url'];
    } else {
        $keys = array_keys($config['metadata']);
        $metadata_url = $config['metadata'][$keys[0]]['url'];
    }
} else {
    $metadata_url = $config['metadata'];
}

$protocol_level = (
    isset($_REQUEST['protocol_level'])
    ? $_REQUEST['protocol_level']
    : (
        isset($config['protocol_level'])
        ? $config['protocol_level']
        : 3
    )
);

$protocol_level = min(3,max(0, $protocol_level));

?>
<!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('metadataplayer','js'));?>"></script>
    
    <script type="text/javascript">
    IriSP.libFiles.defaultDir = "<?php echo(registry_url('libdir','js'));?>";
    IriSP.widgetsDir = "<?php echo(registry_url('ldtwidgets','js'));?>";
    IriSP.libFiles.locations.jwPlayerSWF = "<?php echo(URL_ROOT); ?>res/mediaplayer/player.swf";
    IriSP.language = "<?php echo($actual) ?>";
    
    var _metadata = {
        url: '<?php echo get_metadata_url($metadata_url) ?>?callback=?',
        format: 'ldt'
    };
    var _config = {            
        gui: {
            width: 630,
            container: 'LdtPlayer',
            default_options: {
                metadata: _metadata
            },
            css:'<?php echo(registry_url('metadataplayer','css'));?>',
            widgets: [
<?php if ($protocol_level > 1): ?>
                {
                    type: "Polemic"
<?php if ($protocol_level < 3): ?>
                    ,
                    polemics: []
<?php endif; ?>
                },
<?php endif; ?>
                { type: "Slider" },
                {
                    type: "Controller",
                    disable_annotate_btn: true
                },
                {
                    type: "Segments",
                    annotation_type: [ "chap", "découpage" ]
                },
                { type: "Arrow" },
                {
                    type: "Annotation",
                    annotation_type: [ "chap", "découpage" ]
                },
                { type: "Tweet" },
                { type: "Mediafragment"}
            ]
        },
        player:{
            type:'jwplayer', // player type
            live: true, 
            height: 300, 
            width: 630, 
            provider: "rtmp",
            autostart: true,
            metadata: _metadata
        }
    };
    </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);
</script>
  </body>
</html>