const NodeMediaServer = require('node-media-server');

const config = {
  rtmp: {
    port: 1935,
    chunk_size: 60000,
    gop_cache: true,
    ping: 30,
    ping_timeout: 60
  },
  http: {
    port: 8000,
    mediaroot: './media',
    webroot: './www',
    allow_origin: '*'
  },
  https: {
    port: 8443,
    key: './privatekey.pem',
    cert: './certificate.pem',
  },
  auth: {
    api: true,
    api_user: 'admin',
    api_pass: 'admin',
    play: false,
    publish: false,
    secret: 'nodemedia2019privatekey'
  },
  relay: {
    ffmpeg: './/bin//ffmpeg.exe',
    tasks: [
      {
        app: 'live',
        mode: 'pull',//['static','pull','push']
        edge: 'rtsp://admin:admin12345@192.168.12.6:55421/Streaming/channels/202',
        name: 'ch2', // ffplay http://localhost:8000/cctv/0_149_101.flv
        rtsp_transport : 'tcp' //['udp', 'tcp', 'udp_multicast', 'http']
      },
	  {
        app: 'cctv',
        mode: 'pull',//['static','pull','push']
        edge: 'rtmp://mobliestream.c3tv.com:554/live/goodtv.sdp',
        name: 'ch2', // ffplay http://localhost:8000/cctv/0_149_101.flv
        rtsp_transport : 'tcp' //['udp', 'tcp', 'udp_multicast', 'http']
      }
    ]
  }
};


let nms = new NodeMediaServer(config)
nms.run();

