Remove unused role nginx-rtmp
							parent
							
								
									51c54e4b86
								
							
						
					
					
						commit
						f09ec69ef1
					
				| 
						 | 
				
			
			@ -1,7 +0,0 @@
 | 
			
		|||
#!/usr/bin/env ansible-playbook
 | 
			
		||||
---
 | 
			
		||||
- hosts: nginx_rtmp
 | 
			
		||||
  vars:
 | 
			
		||||
    nginx_rtmp: "{{ glob_nginx_rtmp | default({}) | combine(loc_nginx_rtmp | default({})) }}"
 | 
			
		||||
  roles:
 | 
			
		||||
    - nginx-rtmp
 | 
			
		||||
| 
						 | 
				
			
			@ -1,166 +0,0 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html lang="fr">
 | 
			
		||||
<head>
 | 
			
		||||
  <meta charset="UTF-8">
 | 
			
		||||
  <title>Crans Stream</title>
 | 
			
		||||
  <link href="lib/bootstrap4/css/bootstrap.min.css" rel="stylesheet">
 | 
			
		||||
  <link href="//unpkg.com/video.js@7/dist/video-js.min.css" rel="stylesheet">
 | 
			
		||||
  <style>
 | 
			
		||||
  body, html {
 | 
			
		||||
    height: 100%;
 | 
			
		||||
  }
 | 
			
		||||
  .video-js .vjs-big-play-button {
 | 
			
		||||
    display: none;
 | 
			
		||||
  }
 | 
			
		||||
  </style>
 | 
			
		||||
</head>
 | 
			
		||||
<body class="bg-dark">
 | 
			
		||||
  <div class="container-fluid h-100 p-0">
 | 
			
		||||
      <div class="row align-items-center h-100 mx-0">
 | 
			
		||||
        <div class="col-lg-8">
 | 
			
		||||
          <video id="my-video" class="video-js embed-responsive shadow-lg rounded-sm"></video>
 | 
			
		||||
          <p class="text-right text-white">
 | 
			
		||||
            <a class="text-white text-decoration-none" href="#" id="refreshStream">
 | 
			
		||||
              <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-arrow-repeat" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
 | 
			
		||||
                <path fill-rule="evenodd" d="M2.854 7.146a.5.5 0 0 0-.708 0l-2 2a.5.5 0 1 0 .708.708L2.5 8.207l1.646 1.647a.5.5 0 0 0 .708-.708l-2-2zm13-1a.5.5 0 0 0-.708 0L13.5 7.793l-1.646-1.647a.5.5 0 0 0-.708.708l2 2a.5.5 0 0 0 .708 0l2-2a.5.5 0 0 0 0-.708z"/>
 | 
			
		||||
                <path fill-rule="evenodd" d="M8 3a4.995 4.995 0 0 0-4.192 2.273.5.5 0 0 1-.837-.546A6 6 0 0 1 14 8a.5.5 0 0 1-1.001 0 5 5 0 0 0-5-5zM2.5 7.5A.5.5 0 0 1 3 8a5 5 0 0 0 9.192 2.727.5.5 0 1 1 .837.546A6 6 0 0 1 2 8a.5.5 0 0 1 .501-.5z"/>
 | 
			
		||||
              </svg>
 | 
			
		||||
              Rafraîchir
 | 
			
		||||
            </a>
 | 
			
		||||
            —
 | 
			
		||||
            <a class="text-white text-decoration-none" href="#" id="linkStream">
 | 
			
		||||
              <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-box-arrow-up-right" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
 | 
			
		||||
                <path fill-rule="evenodd" d="M1.5 13A1.5 1.5 0 0 0 3 14.5h8a1.5 1.5 0 0 0 1.5-1.5V9a.5.5 0 0 0-1 0v4a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 0 0-1H3A1.5 1.5 0 0 0 1.5 5v8zm7-11a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-1 0V2.5H9a.5.5 0 0 1-.5-.5z"/>
 | 
			
		||||
                <path fill-rule="evenodd" d="M14.354 1.646a.5.5 0 0 1 0 .708l-8 8a.5.5 0 0 1-.708-.708l8-8a.5.5 0 0 1 .708 0z"/>
 | 
			
		||||
              </svg>
 | 
			
		||||
              Ouvrir le flux dans une application externe
 | 
			
		||||
            </a>
 | 
			
		||||
            —
 | 
			
		||||
            <a class="text-white text-decoration-none" href="#aboutModal" data-toggle="modal">
 | 
			
		||||
              <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-info-square" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
 | 
			
		||||
                <path fill-rule="evenodd" d="M14 1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>
 | 
			
		||||
                <path d="M8.93 6.588l-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588z"/>
 | 
			
		||||
                <circle cx="8" cy="4.5" r="1"/>
 | 
			
		||||
              </svg>
 | 
			
		||||
              À propos
 | 
			
		||||
            </a>
 | 
			
		||||
          </p>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="col-lg-4 h-100 px-0">
 | 
			
		||||
          <div class="embed-responsive h-100 shadow-lg rounded-left">
 | 
			
		||||
            <iframe src="https://irc.crans.org/web/?join=video_NOM&nick=viewer1&password=&realname=Viewer1"></iframe>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="modal fade" id="aboutModal" tabindex="-1">
 | 
			
		||||
    <div class="modal-dialog-centered modal-dialog modal-lg">
 | 
			
		||||
      <div class="modal-content">
 | 
			
		||||
        <div class="modal-header">
 | 
			
		||||
          <h4 class="modal-title" id="exampleModalLabel">À propos</h4>
 | 
			
		||||
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
 | 
			
		||||
            <span aria-hidden="true">×</span>
 | 
			
		||||
          </button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="modal-body">
 | 
			
		||||
          <p>Crans Stream est un service maintenu par le <a href="https://crans.org/">Crans</a> permettant de diffuser un contenu vidéo. Il a pour but d'être utilisé pour diffuser des séminaires ou évènements.</p>
 | 
			
		||||
 | 
			
		||||
          <h4>Comment je diffuse ?</h4>
 | 
			
		||||
          <p>Pour diffuser un contenu vous devez être adhérent Crans et être sur le campus de Cachan.</p>
 | 
			
		||||
          <h5>Avec Open Broadcaster Software</h5>
 | 
			
		||||
          <p>
 | 
			
		||||
            <a href="https://obsproject.com/">Open Broadcaster Software (OBS)</a>
 | 
			
		||||
            est une solution libre et open source de diffusion vidéo.
 | 
			
		||||
            Pour diffuser sur cette plateforme, allez dans l'onglet « Stream (flux) » des paramètres :
 | 
			
		||||
          </p> 
 | 
			
		||||
          <ul>
 | 
			
		||||
            <li><b>Serveur :</b> <code>rtmps://stream.adm.crans.org:1935/live</code>,</li>
 | 
			
		||||
            <li><b>Clé de stream :</b> votre identifiant.</li>
 | 
			
		||||
          </ul>
 | 
			
		||||
          <h5>Avec FFmpeg</h5>
 | 
			
		||||
          <p>
 | 
			
		||||
            <code>
 | 
			
		||||
              ffmpeg -re -i mavideo.webm -vcodec libx264 -vprofile baseline
 | 
			
		||||
              -acodec aac -strict -2 -f flv
 | 
			
		||||
              rtmps://stream.adm.crans.org:1935/live/identifiant
 | 
			
		||||
            </code>
 | 
			
		||||
          </p>
 | 
			
		||||
 | 
			
		||||
          <h4>Mentions légales</h4>
 | 
			
		||||
          <p>
 | 
			
		||||
            Le service de diffusion vidéo du Crans est un service d'hébergement
 | 
			
		||||
            au sens de l'article 6, I, 2e de la loi 2004-575 du 21 juin 2004.
 | 
			
		||||
            Conformément aux dispositions de l'article 6, II du même,
 | 
			
		||||
            l'association Crans conserve les données de nature à permettre
 | 
			
		||||
            l'identification des auteurs du contenu diffusé.
 | 
			
		||||
            Ce service est hébergé par l'association Crans, au
 | 
			
		||||
            61 Avenue du Président Wilson, 94235 Cachan Cedex, France.
 | 
			
		||||
          </p>
 | 
			
		||||
          <p>
 | 
			
		||||
            <b>En cas de réclamation sur le contenu diffusé</b> de type
 | 
			
		||||
            <code>https://stream.crans.org/identifiant</code>,
 | 
			
		||||
            l'auteur peut être contacté par courrier à l'adresse
 | 
			
		||||
            <code>identifiant@crans.org</code>.
 | 
			
		||||
            La loi vous autorise à contacter directement l'hébergeur à
 | 
			
		||||
            l'adresse suivante :
 | 
			
		||||
            <pre>Association Crans - ENS Paris-Saclay<br/>Notification de Contenus Illicites<br/>61, Avenue du Président Wilson<br/>94235 Cachan Cedex<br/>France</pre>
 | 
			
		||||
            Vous pouvez également envoyer directement vos réclamations par
 | 
			
		||||
            courrier électronique à l'adresse <code>bureau[at]crans.org</code>.
 | 
			
		||||
          </p>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <script src="lib/jquery/jquery.min.js"></script>
 | 
			
		||||
  <script src="lib/bootstrap4/js/bootstrap.min.js"></script>
 | 
			
		||||
  <script src="//unpkg.com/video.js@7/dist/video.min.js"></script>
 | 
			
		||||
  <script>
 | 
			
		||||
  // Get current stream
 | 
			
		||||
  let streamId = window.location.pathname.split("/").pop()
 | 
			
		||||
  if (streamId.length === 0) {
 | 
			
		||||
    streamId = "crans"  // default on crans account
 | 
			
		||||
  }
 | 
			
		||||
  const streamUrl = `/hls/${streamId}.m3u8`
 | 
			
		||||
  document.getElementById("linkStream").href = streamUrl
 | 
			
		||||
 | 
			
		||||
  // Create player
 | 
			
		||||
  const player = videojs('my-video', {
 | 
			
		||||
    controls: true,
 | 
			
		||||
    autoplay: true,
 | 
			
		||||
    preload: 'auto',
 | 
			
		||||
    muted: true,
 | 
			
		||||
    fluid: true,
 | 
			
		||||
    aspectRatio: '16:9'
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  function loadStream() {
 | 
			
		||||
    fetch(streamUrl, {
 | 
			
		||||
      method: 'HEAD',
 | 
			
		||||
       cache: 'no-cache'
 | 
			
		||||
    }).then((response) => {
 | 
			
		||||
     if (response.ok) {
 | 
			
		||||
        // Stream exists, load!
 | 
			
		||||
        player.poster()
 | 
			
		||||
        player.src({
 | 
			
		||||
          type: 'application/x-mpegURL',
 | 
			
		||||
           src: streamUrl
 | 
			
		||||
        })
 | 
			
		||||
      } else {
 | 
			
		||||
        // Stream does not exist, alert!
 | 
			
		||||
        player.poster('/no-stream.jpg')
 | 
			
		||||
      }
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $(document).ready(function () {
 | 
			
		||||
    loadStream()
 | 
			
		||||
 | 
			
		||||
    document.getElementById("refreshStream").addEventListener("click", function(){
 | 
			
		||||
      loadStream()
 | 
			
		||||
    })
 | 
			
		||||
  })
 | 
			
		||||
  </script>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 110 KiB  | 
| 
						 | 
				
			
			@ -1,7 +0,0 @@
 | 
			
		|||
---
 | 
			
		||||
 | 
			
		||||
- name: restart nginx
 | 
			
		||||
  service:
 | 
			
		||||
    name: nginx
 | 
			
		||||
    state: restarted
 | 
			
		||||
  become: true
 | 
			
		||||
| 
						 | 
				
			
			@ -1,59 +0,0 @@
 | 
			
		|||
---
 | 
			
		||||
 | 
			
		||||
- name: Install nginx with rtmp module
 | 
			
		||||
  apt:
 | 
			
		||||
    name:
 | 
			
		||||
      - nginx-full
 | 
			
		||||
      - libnginx-mod-rtmp
 | 
			
		||||
      - libjs-bootstrap4
 | 
			
		||||
  register: apt_result
 | 
			
		||||
  retries: 3
 | 
			
		||||
  until: apt_result is succeeded
 | 
			
		||||
  become: yes
 | 
			
		||||
 | 
			
		||||
- name: Copy module and site configuration files
 | 
			
		||||
  template:
 | 
			
		||||
    src: "{{ item }}.j2"
 | 
			
		||||
    dest: "/etc/{{ item }}"
 | 
			
		||||
  loop:
 | 
			
		||||
    - nginx/modules-available/60-rtmp.conf
 | 
			
		||||
    - nginx/sites-available/stream
 | 
			
		||||
  notify: restart nginx
 | 
			
		||||
 | 
			
		||||
- name: Enable NGINX site
 | 
			
		||||
  file:
 | 
			
		||||
    src: /etc/nginx/sites-available/stream
 | 
			
		||||
    dest: /etc/nginx/sites-enabled/stream
 | 
			
		||||
    state: link
 | 
			
		||||
  notify: restart nginx
 | 
			
		||||
 | 
			
		||||
- name: Enable RTMP module
 | 
			
		||||
  file:
 | 
			
		||||
    src: /etc/nginx/modules-available/60-rtmp.conf
 | 
			
		||||
    dest: /etc/nginx/modules-enabled/60-rtmp.conf
 | 
			
		||||
    state: link
 | 
			
		||||
  notify: restart nginx
 | 
			
		||||
 | 
			
		||||
- name: Create site folder
 | 
			
		||||
  file:
 | 
			
		||||
    path: /var/www/stream/hls
 | 
			
		||||
    state: directory
 | 
			
		||||
 | 
			
		||||
- name: Copy index.html and assets
 | 
			
		||||
  copy:
 | 
			
		||||
    src: "{{ item }}"
 | 
			
		||||
    dest: "/var/www/stream/{{ item }}"
 | 
			
		||||
  loop:
 | 
			
		||||
    - index.html
 | 
			
		||||
    - no-stream.jpg
 | 
			
		||||
 | 
			
		||||
- name: Link javascript libs
 | 
			
		||||
  file:
 | 
			
		||||
    src: /usr/share/javascript
 | 
			
		||||
    dest: /var/www/stream/lib
 | 
			
		||||
    state: link
 | 
			
		||||
 | 
			
		||||
- name: Configure tmpfs
 | 
			
		||||
  lineinfile:
 | 
			
		||||
    path: /etc/fstab
 | 
			
		||||
    line: tmpfs /var/www/stream/hls tmpfs rw,noexec,nodev,nosuid 0 0
 | 
			
		||||
| 
						 | 
				
			
			@ -1,18 +0,0 @@
 | 
			
		|||
{{ ansible_header | comment }}
 | 
			
		||||
 | 
			
		||||
rtmp {
 | 
			
		||||
    server {
 | 
			
		||||
        listen 1935;
 | 
			
		||||
        chunk_size 4096;
 | 
			
		||||
        application live {
 | 
			
		||||
            live on;
 | 
			
		||||
            hls on;
 | 
			
		||||
            hls_path /var/www/stream/hls/;
 | 
			
		||||
            hls_fragment 3;
 | 
			
		||||
            hls_playlist_length 20;
 | 
			
		||||
 | 
			
		||||
            record off;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,40 +0,0 @@
 | 
			
		|||
{{ ansible_header | comment }}
 | 
			
		||||
 | 
			
		||||
server {
 | 
			
		||||
    listen 80;
 | 
			
		||||
    listen [::]:80;
 | 
			
		||||
 | 
			
		||||
    server_name {{ nginx_rtmp.uri }};
 | 
			
		||||
 | 
			
		||||
    root /var/www/stream;
 | 
			
		||||
    index index.html;
 | 
			
		||||
 | 
			
		||||
    location / {
 | 
			
		||||
        try_files $uri $uri/ /index.html;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    location /hls {
 | 
			
		||||
        # Disable cache
 | 
			
		||||
        add_header Cache-Control no-cache;
 | 
			
		||||
 | 
			
		||||
        # CORS setup
 | 
			
		||||
        add_header 'Access-Control-Allow-Origin' '*' always;
 | 
			
		||||
        add_header 'Access-Control-Expose-Headers' 'Content-Length';
 | 
			
		||||
 | 
			
		||||
        # allow CORS preflight requests
 | 
			
		||||
        if ($request_method = 'OPTIONS') {
 | 
			
		||||
            add_header 'Access-Control-Allow-Origin' '*';
 | 
			
		||||
            add_header 'Access-Control-Max-Age' 1728000;
 | 
			
		||||
            add_header 'Content-Type' 'text/plain charset=UTF-8';
 | 
			
		||||
            add_header 'Content-Length' 0;
 | 
			
		||||
            return 204;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        types {
 | 
			
		||||
            application/dash+xml mpd;
 | 
			
		||||
            application/vnd.apple.mpegurl m3u8;
 | 
			
		||||
            video/mp2t ts;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue