pili 1.0.0 → 1.0.1
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/README.md +44 -26
- data/lib/pili.rb +8 -0
- data/lib/pili/version.rb +1 -1
- 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: d391f0a344f58f8005ca7d9280ada460e944985a
|
4
|
+
data.tar.gz: fd7f36ef373fb59bfd12dfb85852e040b046ba50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7787e2bbd30689fcb4b30ee4490a799df75d572ec7070c66aa3605fa4a24d4e230c051c72e90749c280465ebdf912de8c0556606d894bab2e8982d82b0bc3425
|
7
|
+
data.tar.gz: d10c030ea7a1be5f76cf9f13d4c52c522e9244e95bd23d3dac0d24faf2fb3d0187a097e3ead8cde07bd16e6afae896948f04a5f8ba5495c7d036e9f8327036d6
|
data/README.md
CHANGED
@@ -24,10 +24,10 @@ Or install it yourself as:
|
|
24
24
|
```ruby
|
25
25
|
require 'pili'
|
26
26
|
|
27
|
-
Pili.setup! access_key: '<YOUR_APP_ACCESS_KEY>',
|
27
|
+
Pili.setup! access_key: '<YOUR_APP_ACCESS_KEY>',
|
28
28
|
secret_key: '<YOUR_APP_SECRET_KEY>'
|
29
29
|
```
|
30
|
-
|
30
|
+
|
31
31
|
#### with rails:
|
32
32
|
|
33
33
|
You'll need to configure it in config/initializes/pili.rb
|
@@ -49,79 +49,97 @@ HUB_NAME = "hub_name"
|
|
49
49
|
#### Create Stream
|
50
50
|
|
51
51
|
```ruby
|
52
|
-
|
53
|
-
|
52
|
+
# HUB_NAME: string, required
|
54
53
|
# title: optional, default is auto-generated
|
55
54
|
# publish_key: optional, a secret key for signing the <publishToken>
|
56
55
|
# publish_security: optional, can be "dynamic" or "static", default is "dynamic"
|
57
|
-
Pili.create_stream(HUB_NAME, title:
|
56
|
+
Pili.create_stream(HUB_NAME, title: "test", publish_key: "werqwedsf", publish_security: "static")
|
58
57
|
```
|
59
58
|
|
60
59
|
#### Get Stream
|
61
60
|
|
62
61
|
```ruby
|
62
|
+
# stream_id: string, required
|
63
63
|
Pili.get_stream(stream_id)
|
64
64
|
```
|
65
|
-
|
65
|
+
|
66
|
+
#### Get Stream Status
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
# stream_id: string, required
|
70
|
+
Pili.get_stream_status(stream_id)
|
71
|
+
```
|
72
|
+
|
66
73
|
#### Update Stream
|
67
74
|
|
68
75
|
```ruby
|
69
|
-
|
76
|
+
# stream_id: string, required
|
77
|
+
# publish_key: optional, a secret key for signing the <publishToken>
|
78
|
+
# publish_security: optional, can be "dynamic" or "static", default is "dynamic"
|
79
|
+
# disabled: optional, can be true or false
|
80
|
+
Pili.update_stream(stream_id, publish_key: "new_key", publish_security: "dynamic", disabled: true)
|
70
81
|
```
|
71
|
-
|
82
|
+
|
72
83
|
#### Get Stream List
|
73
84
|
|
74
85
|
```ruby
|
75
|
-
|
76
|
-
|
77
|
-
# hub: string, required
|
86
|
+
# HUB_NAME: string, required
|
78
87
|
# marker: string, optional
|
79
88
|
# limit: integer, optional
|
80
|
-
Pili.stream_list(HUB_NAME, marker: marker, limit:
|
89
|
+
Pili.stream_list(HUB_NAME, marker: "marker", limit: 50)
|
81
90
|
```
|
82
91
|
|
83
92
|
#### Delete Stream
|
84
93
|
|
85
94
|
```ruby
|
95
|
+
# stream_id: string, required
|
86
96
|
Pili.delete_stream(stream_id)
|
87
97
|
```
|
88
|
-
|
89
|
-
#### Get Stream Segments
|
90
98
|
|
91
|
-
|
92
|
-
Pili.get_stream_segments(stream_id)
|
93
|
-
```
|
99
|
+
#### Get Stream Segments
|
94
100
|
|
95
101
|
```ruby
|
96
|
-
#
|
97
|
-
|
102
|
+
# stream_id: string, required
|
103
|
+
# start_second, end_second: integer, optional
|
104
|
+
Pili.get_stream_segments(stream_id, start_second: 1429678551, end_second: 1429689551)
|
98
105
|
```
|
99
106
|
|
100
107
|
#### Get Stream Publish URL
|
101
108
|
|
102
109
|
```ruby
|
103
|
-
|
104
|
-
|
110
|
+
# RTMP_PUBLISH_HOST, string, required
|
111
|
+
# stream_id: string, required
|
112
|
+
# publish_key: string, required
|
113
|
+
# publish_security: string, required
|
114
|
+
# nonce: unix timestamp, optional
|
115
|
+
Pili.get_stream_publish_url(RTMP_PUBLISH_HOST, stream_id, publish_key, publish_security, nonce)
|
105
116
|
```
|
106
|
-
|
117
|
+
|
107
118
|
#### Get Stream RTMP Live URL
|
108
119
|
|
109
120
|
```ruby
|
110
|
-
|
121
|
+
# RTMP_PLAY_HOST, string, required
|
122
|
+
# stream_id: string, required
|
123
|
+
# profile: string, optional
|
111
124
|
Pili.get_stream_rtmp_live_url(RTMP_PLAY_HOST, stream_id, profile)
|
112
125
|
```
|
113
126
|
|
114
127
|
#### Get Stream HLS Live URL
|
115
128
|
|
116
129
|
```ruby
|
117
|
-
|
130
|
+
# HLS_PLAY_HOST, string, required
|
131
|
+
# stream_id: string, required
|
132
|
+
# profile: string, optional
|
118
133
|
Pili.get_stream_hls_live_url(HLS_PLAY_HOST, stream_id, profile)
|
119
134
|
```
|
120
|
-
|
135
|
+
|
121
136
|
#### Get Stream HLS Playback URL
|
122
137
|
|
123
138
|
```ruby
|
124
|
-
|
139
|
+
# HLS_PLAY_HOST, string, required
|
140
|
+
# stream_id: string, required
|
141
|
+
# start_second, end_second: integer, required
|
142
|
+
# profile: string, optional
|
125
143
|
Pili.get_stream_hls_playback_url(HLS_PLAY_HOST, stream_id, start_second, end_second, profile)
|
126
144
|
```
|
127
145
|
|
data/lib/pili.rb
CHANGED
@@ -52,12 +52,20 @@ module Pili
|
|
52
52
|
end
|
53
53
|
|
54
54
|
|
55
|
+
def get_stream_status(stream_id)
|
56
|
+
url = Config.api_base_url + "/streams/#{stream_id}/status"
|
57
|
+
response = HTTP.api_get(url)
|
58
|
+
response.parsed_response
|
59
|
+
end
|
60
|
+
|
61
|
+
|
55
62
|
def update_stream(stream_id, options = {})
|
56
63
|
url = Config.api_base_url + "/streams/" + stream_id
|
57
64
|
|
58
65
|
body = {
|
59
66
|
:publishKey => options[:publish_key],
|
60
67
|
:publishSecurity => options[:publish_security] == "static" ? "static" : "dynamic",
|
68
|
+
:disabled => options[:disabled]
|
61
69
|
}
|
62
70
|
|
63
71
|
body.delete_if { |k, v| v.nil? }
|
data/lib/pili/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miclle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|