pili 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pili/config.rb +4 -16
- data/lib/pili/utils.rb +5 -0
- data/lib/pili/version.rb +1 -1
- data/lib/pili.rb +16 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf5d334a509a06baeeb43e0d89f0937f4e96a3db
|
4
|
+
data.tar.gz: 04bcbfcffe3cb15134b1aadb2db0ecc59a8166c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 460b40e5b5a7fa7088d87faf4e89b0f57e1203c676f4e5947fc621bcb3f4cb0f6915d3edb52918c862e51c45db366ffec5a3f9a9a61383d3c8c3194b992989f2
|
7
|
+
data.tar.gz: a4638145b882b29acb14e6f39119fa80e20919bbbfa6a9d47f78fbfcab31e6e494c260a094de9160b6913dbe7e20343140d77f3946f6a2f1b3e125018ecde243
|
data/lib/pili/config.rb
CHANGED
@@ -6,11 +6,11 @@ module Pili
|
|
6
6
|
DEFAULT_OPTIONS = {
|
7
7
|
:api_version => "v1",
|
8
8
|
:api_scheme => "http",
|
9
|
-
:api_host => "pili.qiniuapi.com"
|
9
|
+
:api_host => "pili.qiniuapi.com"
|
10
10
|
|
11
|
-
:rtmp_publish_host => "pub.z1.glb.pili.qiniup.com",
|
12
|
-
:rtmp_play_host => "live.z1.glb.pili.qiniucdn.com",
|
13
|
-
:hls_play_host => "hls.z1.glb.pili.qiniuapi.com"
|
11
|
+
# :rtmp_publish_host => "pub.z1.glb.pili.qiniup.com",
|
12
|
+
# :rtmp_play_host => "live.z1.glb.pili.qiniucdn.com",
|
13
|
+
# :hls_play_host => "hls.z1.glb.pili.qiniuapi.com",
|
14
14
|
|
15
15
|
# :access_key => "",
|
16
16
|
# :secret_key => ""
|
@@ -40,18 +40,6 @@ module Pili
|
|
40
40
|
settings[:secret_key]
|
41
41
|
end
|
42
42
|
|
43
|
-
def rtmp_publish_host
|
44
|
-
settings[:rtmp_publish_host]
|
45
|
-
end
|
46
|
-
|
47
|
-
def rtmp_play_host
|
48
|
-
settings[:rtmp_play_host]
|
49
|
-
end
|
50
|
-
|
51
|
-
def hls_play_host
|
52
|
-
settings[:hls_play_host]
|
53
|
-
end
|
54
|
-
|
55
43
|
end
|
56
44
|
end
|
57
45
|
end
|
data/lib/pili/utils.rb
CHANGED
data/lib/pili/version.rb
CHANGED
data/lib/pili.rb
CHANGED
@@ -85,54 +85,50 @@ module Pili
|
|
85
85
|
end
|
86
86
|
|
87
87
|
|
88
|
-
def get_stream_publish_url(stream_id, publish_key, publish_security, nonce = nil)
|
88
|
+
def get_stream_publish_url(publish_host, stream_id, publish_key, publish_security, nonce = nil)
|
89
89
|
nonce = nonce.to_i
|
90
90
|
nonce = (Time.now.to_f * 1000.0).to_i if nonce == 0
|
91
91
|
|
92
|
-
|
93
|
-
hub, title = a[1], a[2]
|
92
|
+
hub, title = Utils.get_stream_hub_and_title(stream_id)
|
94
93
|
|
95
94
|
if publish_security == "static"
|
96
|
-
return "rtmp://#{
|
95
|
+
return "rtmp://#{publish_host}/#{hub}/#{title}?key=#{publish_key}"
|
97
96
|
else
|
98
97
|
token = Auth.sign(publish_key, "/#{hub}/#{title}?nonce=#{nonce}")
|
99
|
-
return "rtmp://#{
|
98
|
+
return "rtmp://#{publish_host}/#{hub}/#{title}?nonce=#{nonce}&token=#{token}"
|
100
99
|
end
|
101
100
|
end
|
102
101
|
|
103
102
|
|
104
|
-
def get_stream_rtmp_live_url(stream_id, preset = nil)
|
105
|
-
|
106
|
-
hub, title = a[1], a[2]
|
103
|
+
def get_stream_rtmp_live_url(play_host, stream_id, preset = nil)
|
104
|
+
hub, title = Utils.get_stream_hub_and_title(stream_id)
|
107
105
|
|
108
106
|
if Utils.blank? preset
|
109
|
-
return "rtmp://#{
|
107
|
+
return "rtmp://#{play_host}/#{hub}/#{title}"
|
110
108
|
else
|
111
|
-
return "rtmp://#{
|
109
|
+
return "rtmp://#{play_host}/#{hub}/#{title}@#{preset}"
|
112
110
|
end
|
113
111
|
end
|
114
112
|
|
115
113
|
|
116
|
-
def get_stream_hls_live_url(stream_id, preset = nil)
|
117
|
-
|
118
|
-
hub, title = a[1], a[2]
|
114
|
+
def get_stream_hls_live_url(play_host, stream_id, preset = nil)
|
115
|
+
hub, title = Utils.get_stream_hub_and_title(stream_id)
|
119
116
|
|
120
117
|
if Utils.blank? preset
|
121
|
-
return "http://#{
|
118
|
+
return "http://#{play_host}/#{hub}/#{title}.m3u8"
|
122
119
|
else
|
123
|
-
return "http://#{
|
120
|
+
return "http://#{play_host}/#{hub}/#{title}@#{preset}.m3u8"
|
124
121
|
end
|
125
122
|
end
|
126
123
|
|
127
124
|
|
128
|
-
def get_stream_hls_playback_url(stream_id, start_second, end_second, preset = nil)
|
129
|
-
|
130
|
-
hub, title = a[1], a[2]
|
125
|
+
def get_stream_hls_playback_url(play_host, stream_id, start_second, end_second, preset = nil)
|
126
|
+
hub, title = Utils.get_stream_hub_and_title(stream_id)
|
131
127
|
|
132
128
|
if Utils.blank? preset
|
133
|
-
return "http://#{
|
129
|
+
return "http://#{play_host}/#{hub}/#{title}.m3u8?start=#{start_second}&end=#{end_second}"
|
134
130
|
else
|
135
|
-
return "http://#{
|
131
|
+
return "http://#{play_host}/#{hub}/#{title}@#{preset}.m3u8?start=#{start_second}&end=#{end_second}"
|
136
132
|
end
|
137
133
|
end
|
138
134
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pili
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miclle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|