module Pili

Constants

VERSION

Public Class Methods

hdl_play_url(domain, hub, stream_title) click to toggle source

生成 HDL 直播地址.

# File lib/pili/client.rb, line 39
def hdl_play_url(domain, hub, stream_title)
  "http://#{domain}/#{hub}/#{stream_title}.flv"
end
hls_play_url(domain, hub, stream_title) click to toggle source

生成 HLS 直播地址.

# File lib/pili/client.rb, line 34
def hls_play_url(domain, hub, stream_title)
  "http://#{domain}/#{hub}/#{stream_title}.m3u8"
end
rtmp_play_url(domain, hub, stream_title) click to toggle source

生成 RTMP 直播地址.

# File lib/pili/client.rb, line 29
def rtmp_play_url(domain, hub, stream_title)
  "rtmp://#{domain}/#{hub}/#{stream_title}"
end
rtmp_publish_url(domain, hub, stream_title, mac, expire_after_seconds) click to toggle source

生成 RTMP 推流地址. expire_after_seconds 表示 URL 在多久之后失效.

# File lib/pili/client.rb, line 21
def rtmp_publish_url(domain, hub, stream_title, mac, expire_after_seconds)
  expire = Time.new.to_i + expire_after_seconds
  path = "/#{hub}/#{stream_title}?e=#{expire}"
  token = mac.sign(path)
  "rtmp://#{domain}#{path}&token=#{token}"
end
snapshot_play_url(domain, hub, stream_title) click to toggle source

生成截图直播地址.

# File lib/pili/client.rb, line 44
def snapshot_play_url(domain, hub, stream_title)
  "http://#{domain}/#{hub}/#{stream_title}.jpg"
end