rails-jwplayer 0.1.0

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.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +73 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/lib/assets/javascripts/rails-jwplayer.js +4 -0
  13. data/lib/rails/jwplayer/engine.rb +5 -0
  14. data/lib/rails/jwplayer/helper.rb +29 -0
  15. data/lib/rails/jwplayer/version.rb +5 -0
  16. data/lib/rails/jwplayer.rb +14 -0
  17. data/rails-jwplayer.gemspec +26 -0
  18. data/vendor/assets/javascripts/jwplayer/jw-icons.ttf +0 -0
  19. data/vendor/assets/javascripts/jwplayer/jw-icons.woff +0 -0
  20. data/vendor/assets/javascripts/jwplayer/jwplayer.flash.swf +0 -0
  21. data/vendor/assets/javascripts/jwplayer/jwplayer.js +7 -0
  22. data/vendor/assets/javascripts/jwplayer/jwplayer.loader.swf +0 -0
  23. data/vendor/assets/javascripts/jwplayer/polyfills.base64.js +1 -0
  24. data/vendor/assets/javascripts/jwplayer/polyfills.intersection-observer.js +1 -0
  25. data/vendor/assets/javascripts/jwplayer/polyfills.promise.js +1 -0
  26. data/vendor/assets/javascripts/jwplayer/polyfills.vttrenderer.js +1 -0
  27. data/vendor/assets/javascripts/jwplayer/provider.airplay.js +1 -0
  28. data/vendor/assets/javascripts/jwplayer/provider.cast.js +1 -0
  29. data/vendor/assets/javascripts/jwplayer/provider.flash.js +1 -0
  30. data/vendor/assets/javascripts/jwplayer/provider.hlsjs.js +8 -0
  31. data/vendor/assets/javascripts/jwplayer/provider.html5.js +1 -0
  32. data/vendor/assets/javascripts/jwplayer/provider.shaka.js +6 -0
  33. data/vendor/assets/javascripts/jwplayer/provider.youtube.js +1 -0
  34. data/vendor/assets/javascripts/jwplayer/skins/beelden.css +1 -0
  35. data/vendor/assets/javascripts/jwplayer/skins/bekle.css +1 -0
  36. data/vendor/assets/javascripts/jwplayer/skins/five.css +1 -0
  37. data/vendor/assets/javascripts/jwplayer/skins/glow.css +1 -0
  38. data/vendor/assets/javascripts/jwplayer/skins/roundster.css +1 -0
  39. data/vendor/assets/javascripts/jwplayer/skins/seven.css +1 -0
  40. data/vendor/assets/javascripts/jwplayer/skins/six.css +1 -0
  41. data/vendor/assets/javascripts/jwplayer/skins/stormtrooper.css +1 -0
  42. data/vendor/assets/javascripts/jwplayer/skins/vapor.css +1 -0
  43. data/vendor/assets/javascripts/jwplayer/vttparser.js +1 -0
  44. metadata +128 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8597c840109bf668da7676fe5657b8fb350b2e4a
4
+ data.tar.gz: f66a602b551a75e743f29b1c45984eeb03fc8e4f
5
+ SHA512:
6
+ metadata.gz: 0aabb24f07dd074db0b656e5b7d4269d82a695a5f17a02263e9fc048c4b8369614a7af6842ab802ca7cc4ea18dc460f0fd563f97fc72a454079fad5746a445f6
7
+ data.tar.gz: 806ffd1a79d701ebdd9ace58f77bce7a6815b5871a3c4039f12c24974020b9d9d7927c588aec5b0e0c001a1cc7b02d7ab69f5863796a829794d3fa4616f096b9
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.13.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at xuyao@cloudoc.cn. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rails-jwplayer.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 徐耀
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Rails::Jwplayer
2
+ **rails-jwplayer** is JW Player for Rails, it provides a jwplayer_tag helper to create JW Player video plugin. Current version of JW Player is 7.10.5
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'rails-jwplayer'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install rails-jwplayer
19
+
20
+ And add this require statement to your `application.js` file:
21
+ //= require rails-jwplayer
22
+
23
+ ## Configuration
24
+
25
+ you need to create configuration file jwplayer.rb, and setup the jwplayer.key
26
+ ```ruby
27
+ # config/initializers/jwplayer.rb
28
+ Rails::Jwplayer.key = "your jwplayer key"
29
+
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ First include jwplayer config on the page
35
+ ```ruby
36
+ <%= jwplayer_config_include %>
37
+ ```
38
+ Than place a div with JW Player
39
+ ```ruby
40
+ <%= jwplayer_tag(file: "you video url") %>
41
+ ```
42
+ You can pass other options to jwplayer helper to customize it:
43
+ ```ruby
44
+ <%= jwplayer_tag(file: "you video url", width: 400, height: 300, autostart: true, repeat: true) %>
45
+ ```
46
+ More information for customization could be found [JW Player configuration](https://developer.jwplayer.com/jw-player/docs/developer-guide/customization/configuration-reference/)
47
+
48
+ You can use the Javascript API component of JW Player, This API can be used to enhance the functionality of your video embeds, or to implement rich page-level video interactions, more information [JW Player Javascript API](https://developer.jwplayer.com/jw-player/docs/developer-guide/api/javascript_api_introduction/)
49
+ ```ruby
50
+ jwplayer.on('pause', function(event){
51
+ console.log('pause');
52
+ });
53
+ ```
54
+ Or get the pause method
55
+
56
+ ```ruby
57
+ jwplayer.pause()
58
+ ```
59
+ ## Development
60
+
61
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
62
+
63
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
64
+
65
+ ## Contributing
66
+
67
+ Bug reports and pull requests are welcome on GitHub at https://github.com/xuyao91/rails-jwplayer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
68
+
69
+
70
+ ## License
71
+
72
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
73
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rails/jwplayer"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,4 @@
1
+ //
2
+ // JW Player bootstrap for rails-jwplayer helper
3
+ //
4
+ //= require jwplayer/jwplayer
@@ -0,0 +1,5 @@
1
+ module Rails::Jwplayer
2
+ class Engine < ::Rails::Engine
3
+
4
+ end
5
+ end
@@ -0,0 +1,29 @@
1
+ module Rails::Jwplayer
2
+ module Helper
3
+ DEFAULT_OPTIONS = {
4
+ id: "jwplayer",
5
+ flashplayer: "/assets/jwplayer/jwplayer.flash.swf"
6
+ }
7
+
8
+ def jwplayer_config_include
9
+ return raise "missing license key" if Rails::Jwplayer.key.nil?
10
+
11
+ jwplayer_config_js = <<-JWPLAYER_CONFIG_JS
12
+ jwplayer.key = "#{Rails::Jwplayer.key}";
13
+ JWPLAYER_CONFIG_JS
14
+ javascript_tag jwplayer_config_js, type: 'application/javascript'
15
+ end
16
+
17
+ def jwplayer_tag(options = {})
18
+ options = DEFAULT_OPTIONS.merge(options)
19
+
20
+ respond = %Q{<div id='#{options[:id]}'>This div will be replaced by the JW Player.</div>
21
+ <script type='text/javascript'>
22
+ var jwplayer = jwplayer('#{options.delete(:id)}').setup(#{options.to_json});
23
+ </script>}
24
+
25
+ respond.respond_to?(:html_safe) ? respond.html_safe : respond
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ module Rails
2
+ module Jwplayer
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ require "rails/jwplayer/engine"
2
+ require "rails/jwplayer/version"
3
+ require "rails/jwplayer/helper"
4
+
5
+ module Rails
6
+ module Jwplayer
7
+
8
+ class << self
9
+ attr_accessor :key
10
+ end
11
+ end
12
+ end
13
+
14
+ ActionView::Base.send :include, Rails::Jwplayer::Helper if defined? ActionView::Base
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rails/jwplayer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rails-jwplayer"
8
+ spec.version = Rails::Jwplayer::VERSION
9
+ spec.authors = ["peter"]
10
+ spec.email = ["xy9123@126.com"]
11
+
12
+ spec.summary = %q{JWPlayer for rails helpers}
13
+ spec.homepage = "https://github.com/xuyao91/rails-jwplayer"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.13"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ end