framey 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.
- data/Manifest.txt +1 -1
- data/README.md +122 -0
- data/Rakefile +3 -1
- data/lib/framey.rb +1 -1
- data/lib/framey/api.rb +10 -1
- data/lib/framey/configuration.rb +1 -1
- data/lib/framey/view_helpers.rb +26 -2
- metadata +5 -6
- data/README.txt +0 -53
data/Manifest.txt
CHANGED
data/README.md
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
# The Framey Ruby Gem
|
2
|
+
|
3
|
+
This gem can be used for easy Rails integration with the Framey video recording service. See http://framey.com for more information.
|
4
|
+
|
5
|
+
# Dependencies:
|
6
|
+
|
7
|
+
* httparty (ruby gem)
|
8
|
+
* swfobject (javascript file)
|
9
|
+
|
10
|
+
# Installation
|
11
|
+
|
12
|
+
If not using bundler, do:
|
13
|
+
|
14
|
+
`gem install framey`
|
15
|
+
|
16
|
+
otherwise in your Gemfile:
|
17
|
+
|
18
|
+
`gem framey`
|
19
|
+
|
20
|
+
# User / Development Flow
|
21
|
+
|
22
|
+
* You make a page on your site that displays the Framey flash video recorder
|
23
|
+
* Your user visits that page and clicks record
|
24
|
+
* If your user likes the video she just recorded, she clicks "Publish"
|
25
|
+
* After a little while, Framey pings your servers at a specified callback url with a url to the video file
|
26
|
+
* You can choose to store those urls on your end, or just the id of the Framey video to access it later on Framey via an API call
|
27
|
+
* You then display the video to your user using either the Framey video player or your own favorite flash video player
|
28
|
+
|
29
|
+
# Usage
|
30
|
+
|
31
|
+
First, sign up at http://framey.com to get an API key and secret and to set your callback url.
|
32
|
+
|
33
|
+
Then in environment.rb do:
|
34
|
+
|
35
|
+
Framey.configure do |config|
|
36
|
+
config.api_key = "[YOUR API KEY]" # required
|
37
|
+
config.api_secret = "[YOUR API SECRET]" # required
|
38
|
+
config.api_timeout = [API SIGNATURE EXPIRATION IN MINUTES] # optional (15 by default)
|
39
|
+
config.max_recording_time = [DEFAULT MAXIMUM VIDEO LENGTH] # optional (30 by default)
|
40
|
+
end
|
41
|
+
|
42
|
+
To render the Framey video recorder in an ActionView (example assumes ERB) do:
|
43
|
+
|
44
|
+
<%= javascript_include_tag "swfobject" %>
|
45
|
+
<%= render_recorder({
|
46
|
+
:max_time => 60, # maximum allowed video length in seconds (optional, defaults to 30)
|
47
|
+
:session_data => { # custom parameters to be passed along to your app later (optional)
|
48
|
+
:user_id => <%= @user.id %> # you may, for example, want to relate this recording to a specific user in your system
|
49
|
+
}
|
50
|
+
}) %>
|
51
|
+
|
52
|
+
When your user then views this recorder, records a video, and clicks "Publish", your app receives a POST to the specified callback url with the following parameters:
|
53
|
+
|
54
|
+
{
|
55
|
+
:video => {
|
56
|
+
:name => [video name], # this is the video's UUID within the Framey system
|
57
|
+
:filesize => [filesize], # the filesize in bytes of the video
|
58
|
+
:duration => [duration], # the duration of the video in seconds
|
59
|
+
:state => [state], # the state of the video, in this case "uploaded"
|
60
|
+
:views => [number of views], # the number of times this video has been viewed, in this case 0
|
61
|
+
:data => [the data hash you specified], # this is the exact data you specified in the :session_data hash when rendering the recorder
|
62
|
+
:url => [video url], # url to the flash video file on framey that you can feed into a video player later
|
63
|
+
:thumbnail => [thumbnail url] # url to the thumbnail image that was generated for this video
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
To render the Framey video player in an ActionView (example assumes ERB) do:
|
68
|
+
|
69
|
+
<%= javascript_include_tag "swfobject" %>
|
70
|
+
<%= render_player({
|
71
|
+
:video_url => "[video url]", # the video url received in the callback (required)
|
72
|
+
:thumbnail_url => "[thumbnail url]", # the thumbnail url received in the callback (required)
|
73
|
+
:progress_bar_color => "0x123456", # the desired color for the progress bar (optional, defaults to black)
|
74
|
+
:volume_bar_color => "0x123456", # the desired color for the volume bar (optional, defaults to black)
|
75
|
+
})%>
|
76
|
+
|
77
|
+
Note that you don't have to use the Framey video player, though, and can use any other flash video player you'd like.
|
78
|
+
|
79
|
+
To get updated stats information about a given video, do:
|
80
|
+
|
81
|
+
@video = Framey::Api.get_video("[framey video name]")
|
82
|
+
|
83
|
+
This returns a simple Framey::Video object, like so:
|
84
|
+
|
85
|
+
#<Framey::Video:0x1037b4450 @state="uploaded", @filesize=123456, @name="c96323e0-54b1-012e-9d34-7c6d628c53d4", @thumbnail="http://framey.com/videos/c96323e0-54b1-012e-9d34-7c6d628c53d4/thumbnail.jpg", @data={"user_id" => 1}, @url="http://framey.com/videos/c96323e0-54b1-012e-9d34-7c6d628c53d4/source.flv", @views=12, @duration=15.62>
|
86
|
+
|
87
|
+
To delete a video on Framey, do:
|
88
|
+
|
89
|
+
@video.delete!
|
90
|
+
|
91
|
+
or:
|
92
|
+
|
93
|
+
Framey::Api.delete_video("[framey video name]")
|
94
|
+
|
95
|
+
# Other Documentation
|
96
|
+
|
97
|
+
* http://rubydoc.info/gems/framey/1.0.0/frames
|
98
|
+
|
99
|
+
# License
|
100
|
+
|
101
|
+
(The MIT License)
|
102
|
+
|
103
|
+
Copyright (c) 2011 FIX
|
104
|
+
|
105
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
106
|
+
a copy of this software and associated documentation files (the
|
107
|
+
'Software'), to deal in the Software without restriction, including
|
108
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
109
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
110
|
+
permit persons to whom the Software is furnished to do so, subject to
|
111
|
+
the following conditions:
|
112
|
+
|
113
|
+
The above copyright notice and this permission notice shall be
|
114
|
+
included in all copies or substantial portions of the Software.
|
115
|
+
|
116
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
117
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
118
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
119
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
120
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
121
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
122
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'hoe'
|
|
3
3
|
$:.unshift(File.dirname(__FILE__) + "/lib")
|
4
4
|
require 'framey'
|
5
5
|
|
6
|
-
Hoe.new('framey', "1.0.
|
6
|
+
Hoe.new('framey', "1.0.1") do |p|
|
7
7
|
p.name = "framey"
|
8
8
|
p.author = "Shaun Salzberg"
|
9
9
|
p.description = "A gem for easy Rails integration with the Framey video recording service."
|
@@ -13,3 +13,5 @@ Hoe.new('framey', "1.0.0") do |p|
|
|
13
13
|
p.changes = p.paragraphs_of('CHANGELOG', 0..1).join("\n\n")
|
14
14
|
p.remote_rdoc_dir = '' # Release to root
|
15
15
|
end
|
16
|
+
|
17
|
+
|
data/lib/framey.rb
CHANGED
data/lib/framey/api.rb
CHANGED
@@ -3,11 +3,20 @@ require 'httparty'
|
|
3
3
|
|
4
4
|
module Framey
|
5
5
|
module Api
|
6
|
+
|
7
|
+
# Use this method to fetch updating information about a recording.
|
8
|
+
#
|
9
|
+
# Example Usage:
|
10
|
+
# Framey::Api.get_video("c96323e0-54b1-012e-9d34-7c6d628c53d4")
|
6
11
|
def self.get_video(video_name)
|
7
12
|
res = self.make_request("get","/api/videos/#{video_name}")
|
8
13
|
return Video.new(res["video"])
|
9
14
|
end
|
10
|
-
|
15
|
+
|
16
|
+
# Use this method to delete a recording.
|
17
|
+
#
|
18
|
+
# Example Usage:
|
19
|
+
# Framey::Api.delete_video("c96323e0-54b1-012e-9d34-7c6d628c53d4")
|
11
20
|
def self.delete_video(video_name)
|
12
21
|
res = self.make_request("delete","/api/videos/#{video_name}")
|
13
22
|
return true
|
data/lib/framey/configuration.rb
CHANGED
data/lib/framey/view_helpers.rb
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
module Framey
|
2
2
|
|
3
3
|
module ViewHelpers
|
4
|
+
|
5
|
+
# This method renders the Framey video recorder from within an ActionView in your Rails app.
|
6
|
+
#
|
7
|
+
# Example Usage (assuming ERB):
|
8
|
+
# <%= javascript_include_tag "swfobject" %>
|
9
|
+
# <%= render_recorder({
|
10
|
+
# :id => "[some id]" # the id of the flash embed object (optional, random by default)
|
11
|
+
# :max_time => 60, # maximum allowed video length in seconds (optional, defaults to 30)
|
12
|
+
# :session_data => { # custom parameters to be passed along to your app later (optional)
|
13
|
+
# :user_id => <%= @user.id %> # you may, for example, want to relate this recording to a specific user in your system
|
14
|
+
# }
|
15
|
+
# }) %>
|
4
16
|
def render_recorder(opts={})
|
5
17
|
api_key = Framey.api_key
|
6
18
|
timestamp, signature = Framey::Api.sign
|
@@ -8,7 +20,7 @@ module Framey
|
|
8
20
|
run_env = Framey.run_env
|
9
21
|
max_time = opts[:max_time] || 30
|
10
22
|
divid = "frameyRecorderContainer_#{(rand*999999999).to_i}"
|
11
|
-
objid = "the#{divid}"
|
23
|
+
objid = opts[:id] || "the#{divid}"
|
12
24
|
|
13
25
|
raw <<END_RECORDER
|
14
26
|
<div id="#{divid}"></div>
|
@@ -34,12 +46,24 @@ raw <<END_RECORDER
|
|
34
46
|
END_RECORDER
|
35
47
|
end
|
36
48
|
|
49
|
+
|
50
|
+
# This method renders the Framey video player from within an ActionView in your Rails app.
|
51
|
+
#
|
52
|
+
# Example Usage (assuming ERB):
|
53
|
+
# <%= javascript_include_tag "swfobject" %>
|
54
|
+
# <%= render_player({
|
55
|
+
# :video_url => "[video url]", # the video url received in the callback (required)
|
56
|
+
# :thumbnail_url => "[thumbnail url]", # the thumbnail url received in the callback (required)
|
57
|
+
# :progress_bar_color => "0x123456", # the desired color for the progress bar (optional, defaults to black)
|
58
|
+
# :volume_bar_color => "0x123456", # the desired color for the volume bar (optional, defaults to black)
|
59
|
+
# :id => "[some id]" # the id of the flash embed object (optional, random by default)
|
60
|
+
# }) %>
|
37
61
|
def render_player(opts={})
|
38
62
|
video_url = opts[:video_url] || "#{Framey.api_host}/videos/#{opts[:video_name]}/source.flv"
|
39
63
|
thumbnail_url = opts[:thumbnail_url] || "#{Framey.api_host}/videos/#{opts[:video_name]}/thumbnail.jpg"
|
40
64
|
|
41
65
|
divid = "frameyPlayerContainer_#{(rand*999999999).to_i}"
|
42
|
-
objid = "the#{divid}"
|
66
|
+
objid = opts[:id] || "the#{divid}"
|
43
67
|
|
44
68
|
progress_bar_color = "#{opts[:progress_bar_color]}"
|
45
69
|
volume_bar_color = "#{opts[:volume_bar_color]}"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: framey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Shaun Salzberg
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-05-02 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: hoe
|
@@ -41,11 +41,10 @@ extensions: []
|
|
41
41
|
|
42
42
|
extra_rdoc_files:
|
43
43
|
- Manifest.txt
|
44
|
-
- README.txt
|
45
44
|
files:
|
46
45
|
- Manifest.txt
|
47
46
|
- Rakefile
|
48
|
-
- README.
|
47
|
+
- README.md
|
49
48
|
- lib/framey.rb
|
50
49
|
- lib/framey/api.rb
|
51
50
|
- lib/framey/configuration.rb
|
data/README.txt
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
= framey
|
2
|
-
|
3
|
-
* http://framey.com
|
4
|
-
|
5
|
-
== DESCRIPTION:
|
6
|
-
|
7
|
-
This ruby gem can be used for easy Rails integration with the Framey video recording service.
|
8
|
-
|
9
|
-
== FEATURES/PROBLEMS:
|
10
|
-
|
11
|
-
* Easily embed the framey recorders and players and make API calls to the framey web service.
|
12
|
-
|
13
|
-
== SYNOPSIS:
|
14
|
-
|
15
|
-
Framey::API.get_video([your video name])
|
16
|
-
Framey::API.delete_video([your video name])
|
17
|
-
<%= render_recorder %>
|
18
|
-
<%= render_player(:video_url => [your framey video url]) %>
|
19
|
-
|
20
|
-
== REQUIREMENTS:
|
21
|
-
|
22
|
-
* httparty
|
23
|
-
|
24
|
-
== INSTALL:
|
25
|
-
|
26
|
-
* sudo gem install framey
|
27
|
-
|
28
|
-
== DEVELOPERS:
|
29
|
-
|
30
|
-
== LICENSE:
|
31
|
-
|
32
|
-
(The MIT License)
|
33
|
-
|
34
|
-
Copyright (c) 2011 FIX
|
35
|
-
|
36
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
37
|
-
a copy of this software and associated documentation files (the
|
38
|
-
'Software'), to deal in the Software without restriction, including
|
39
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
40
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
41
|
-
permit persons to whom the Software is furnished to do so, subject to
|
42
|
-
the following conditions:
|
43
|
-
|
44
|
-
The above copyright notice and this permission notice shall be
|
45
|
-
included in all copies or substantial portions of the Software.
|
46
|
-
|
47
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
48
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
49
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
50
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
51
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
52
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
53
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|