framey 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -19,6 +19,10 @@ otherwise in your Gemfile:
19
19
 
20
20
  `gem framey`
21
21
 
22
+ There are two options for using the framey gem: using included scaffold code for views, models and callbacks or creating your own views. Depending on your choice, follow the appropriate instructions below to complete the installation.
23
+
24
+ ## Using the included scaffold
25
+
22
26
  Run the framey generator:
23
27
 
24
28
  `rails generate framey API_KEY API_SECRET`
@@ -31,6 +35,7 @@ This automatically creates default views, controller and routes for recording an
31
35
  /framey/callback
32
36
 
33
37
  Create the supporting database tables:
38
+
34
39
  rake db:migrate
35
40
 
36
41
  Edit the default configuration options in config/framey.rb:
@@ -42,6 +47,21 @@ Edit the default configuration options in config/framey.rb:
42
47
  API_TIMEOUT = 15
43
48
  MAX_TIME = 30
44
49
 
50
+ ## Creating your own views
51
+
52
+ Create a framey initializer at config/framey.rb and modify the following code to use your API keys
53
+
54
+ module Framey
55
+ API_HOST = "http://framey.com"
56
+ RUN_ENV = "production"
57
+ API_KEY = "API_KEY_VALUE"
58
+ SECRET = "API_SECRET_VALUE"
59
+ API_TIMEOUT = 15
60
+ MAX_TIME = 30
61
+ end
62
+
63
+
64
+
45
65
  # User / Development Flow
46
66
 
47
67
  * You make a page on your site that displays the Framey flash video recorder
@@ -1,95 +1,4 @@
1
1
  module Framey
2
2
  module VideosHelper
3
- # This method renders the Framey video recorder from within an ActionView in your Rails app.
4
- #
5
- # Example Usage (assuming ERB):
6
- # <%= javascript_include_tag "swfobject" %>
7
- # <%= render_recorder({
8
- # :id => "[some id]" # the id of the flash embed object (optional, random by default)
9
- # :max_time => 60, # maximum allowed video length in seconds (optional, defaults to 30)
10
- # :session_data => { # custom parameters to be passed along to your app later (optional)
11
- # :user_id => <%= @user.id %> # you may, for example, want to relate this recording to a specific user in your system
12
- # }
13
- # }) %>
14
- def render_recorder(opts={})
15
- api_key = Framey::API_KEY
16
- timestamp, signature = Framey::Api.sign
17
- session_data = (opts[:session_data]||{}).map { |k,v| "#{k.to_s}=#{v.to_s}" }.join(",")
18
- run_env = Framey::RUN_ENV
19
- max_time = opts[:max_time] || Framey::MAX_TIME
20
- divid = "frameyRecorderContainer_#{(rand*999999999).to_i}"
21
- objid = opts[:id] || "the#{divid}"
22
-
23
- raw <<END_RECORDER
24
- <div id="#{divid}"></div>
25
- <script type="text/javascript">
26
- var flashvars = {
27
- api_key: "#{api_key}",
28
- signature: "#{signature}",
29
- time_stamp: "#{timestamp}",
30
- session_data: "#{session_data}",
31
- run_env: "#{run_env}",
32
- max_time: "#{max_time.to_s}"
33
- };
34
- var params = {
35
- 'allowscriptaccess': 'always',
36
- "wmode": "transparent"
37
- };
38
- var attributes = {
39
- 'id': "#{objid}",
40
- 'name': "#{objid}"
41
- };
42
- swfobject.embedSWF("/recorder.swf", "#{divid}", "340", "340", "8", "", flashvars, params, attributes);
43
- </script>
44
- END_RECORDER
45
- end
46
-
47
-
48
- # This method renders the Framey video player from within an ActionView in your Rails app.
49
- #
50
- # Example Usage (assuming ERB):
51
- # <%= javascript_include_tag "swfobject" %>
52
- # <%= render_player({
53
- # :video_url => "[video url]", # the video url received in the callback (required)
54
- # :thumbnail_url => "[thumbnail url]", # the thumbnail url received in the callback (required)
55
- # :progress_bar_color => "0x123456", # the desired color for the progress bar (optional, defaults to black)
56
- # :volume_bar_color => "0x123456", # the desired color for the volume bar (optional, defaults to black)
57
- # :id => "[some id]" # the id of the flash embed object (optional, random by default)
58
- # }) %>
59
- def render_player(opts={})
60
- video_url = opts[:video_url] || "#{Framey::API_HOST}/videos/#{opts[:video_name]}/source.flv"
61
- thumbnail_url = opts[:thumbnail_url] || "#{Framey::API_HOST}/videos/#{opts[:video_name]}/thumbnail.jpg"
62
-
63
- divid = "frameyPlayerContainer_#{(rand*999999999).to_i}"
64
- objid = opts[:id] || "the#{divid}"
65
-
66
- progress_bar_color = "#{opts[:progress_bar_color]}"
67
- volume_bar_color = "#{opts[:volume_bar_color]}"
68
-
69
- raw <<END_PLAYER
70
- <div id="#{divid}"></div>
71
- <script type="text/javascript">
72
- var flashvars = {
73
- 'video_url': "#{video_url}",
74
- 'thumbnail_url': "#{thumbnail_url}",
75
- "progress_bar_color": "#{progress_bar_color}",
76
- "volume_bar_color": "#{volume_bar_color}"
77
- };
78
-
79
- var params = {
80
- 'allowfullscreen': 'true',
81
- 'allowscriptaccess': 'always',
82
- "wmode": "transparent"
83
- };
84
-
85
- var attributes = {
86
- 'id': "#{objid}",
87
- 'name': "#{objid}"
88
- };
89
-
90
- swfobject.embedSWF("/player.swf", "#{divid}", '340', '290', '9', 'false', flashvars, params, attributes);
91
- </script>
92
- END_PLAYER
93
- end
94
3
  end
95
4
  end
data/lib/framey.rb CHANGED
@@ -5,4 +5,5 @@ module Framey
5
5
  require 'httparty'
6
6
  require 'will_paginate'
7
7
  require 'api'
8
+ require 'view_helpers'
8
9
  end
data/lib/view_helpers.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  module Framey
2
-
3
2
  module ViewHelpers
4
-
5
3
  # This method renders the Framey video recorder from within an ActionView in your Rails app.
6
4
  #
7
5
  # Example Usage (assuming ERB):
@@ -14,11 +12,11 @@ module Framey
14
12
  # }
15
13
  # }) %>
16
14
  def render_recorder(opts={})
17
- api_key = Framey.api_key
15
+ api_key = Framey::API_KEY
18
16
  timestamp, signature = Framey::Api.sign
19
17
  session_data = (opts[:session_data]||{}).map { |k,v| "#{k.to_s}=#{v.to_s}" }.join(",")
20
- run_env = Framey.run_env
21
- max_time = opts[:max_time] || 30
18
+ run_env = Framey::RUN_ENV
19
+ max_time = opts[:max_time] || Framey::MAX_TIME
22
20
  divid = "frameyRecorderContainer_#{(rand*999999999).to_i}"
23
21
  objid = opts[:id] || "the#{divid}"
24
22
 
@@ -94,9 +92,7 @@ raw <<END_PLAYER
94
92
  END_PLAYER
95
93
  end
96
94
  end
97
-
98
95
  end
99
-
100
96
  module ActionView
101
97
  module Helpers
102
98
  include Framey::ViewHelpers
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: framey
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-07 00:00:00.000000000Z
12
+ date: 2011-09-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &2161364280 !ruby/object:Gem::Requirement
16
+ requirement: &2153424500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2161364280
24
+ version_requirements: *2153424500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: will_paginate
27
- requirement: &2161362860 !ruby/object:Gem::Requirement
27
+ requirement: &2153423140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2161362860
35
+ version_requirements: *2153423140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &2161361840 !ruby/object:Gem::Requirement
38
+ requirement: &2153421820 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,8 +43,8 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2161361840
47
- description: TO DO
46
+ version_requirements: *2153421820
47
+ description: A gem for easy Rails integration with the Framey video recording service.
48
48
  email: david@qlabs.com
49
49
  executables: []
50
50
  extensions: []