video_player 0.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/README.md +27 -11
- data/lib/video_player/version.rb +1 -1
- data/lib/video_player.rb +12 -1
- data/video_player.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13d041c39efc5dc285f83828db2dbee7b1392675
|
4
|
+
data.tar.gz: a498e6ef1a0875de55ed8ea241d20fa5f70450c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9aec32148aff5bdce7522d34384473f8210613581d5c714deb4eb296834f80da968613a896b8f46cc1c6cd6d8f6fdcdd79a650a5b9dc4f1823ff056c4782ec16
|
7
|
+
data.tar.gz: 54facf3e0e20f8a3269243d03e8cd308b24b398742a253f72c942d333bfa4c81de3879ccc2d9a4b0e8cee145e9f7b4a019304a0b543e9d0fb8b54d862a74d62d
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# Video player for Youtube and
|
1
|
+
# Video player for Youtube, Vimeo and İzlesene
|
2
2
|
[](http://badge.fury.io/rb/video_player)
|
3
3
|
|
4
|
-
Create video player for Youtube and
|
4
|
+
Create video player for Youtube, Vimeo and İzlesene videos for Ruby.
|
5
5
|
|
6
6
|
And it may support more video hoster with your [contributions](#contributing).
|
7
7
|
|
@@ -25,20 +25,29 @@ or install the gem on terminal.
|
|
25
25
|
|
26
26
|
**url**
|
27
27
|
|
28
|
-
> Youtube
|
28
|
+
> Youtube, Vimeo and İzlesene video link
|
29
|
+
>
|
29
30
|
> http://www.youtube.com/watch?v=iEPTlhBmwRg
|
31
|
+
>
|
30
32
|
> or
|
33
|
+
>
|
31
34
|
> http://vimeo.com/101419884
|
35
|
+
>
|
36
|
+
> or
|
37
|
+
>
|
38
|
+
> http://www.izlesene.com/video/feder-goodbye-feat-lyse/7886121
|
32
39
|
|
33
40
|
**width** *(default = 420)*
|
41
|
+
|
34
42
|
**height** *(default = 315)*
|
43
|
+
|
35
44
|
**autoplay** *(default = true)* - works only on Youtube
|
36
45
|
|
37
46
|
|
38
47
|
## Usage
|
39
48
|
|
40
49
|
```ruby
|
41
|
-
require 'video_player'
|
50
|
+
require 'video_player' # if you're not use Rails 4
|
42
51
|
VideoPlayer::player("http://vimeo.com/101419884")
|
43
52
|
# returns iframe player from Vimeo video
|
44
53
|
# <iframe src=\"//player.vimeo.com/video/101419884\" width=\"420\" height=\"315\" frameborder=\"0\"></iframe>
|
@@ -46,20 +55,27 @@ VideoPlayer::player("http://vimeo.com/101419884")
|
|
46
55
|
VideoPlayer::player("http://www.youtube.com/watch?v=iEPTlhBmwRg", "1200", "800", true)
|
47
56
|
# returns iframe player which has 1200px width and 800px height with autoplay from Youtube video
|
48
57
|
# <iframe width=\"1200\" height=\"800\" src=\"//www.youtube.com/embed/iEPTlhBmwRg?autoplay=1&rel=0\" frameborder=\"0\" allowfullscreen></iframe>
|
58
|
+
|
59
|
+
VideoPlayer::player("http://www.izlesene.com/video/feder-goodbye-feat-lyse/7886121")
|
60
|
+
# returns iframe player from İzlesene video
|
61
|
+
# <iframe width=\"420\" height=\"315\" src=\"//www.izlesene.com/embedplayer/7886121/?autoplay=1&showrel=0&showinfo=0\" frameborder=\"0\" allowfullscreen></iframe>
|
49
62
|
```
|
50
63
|
|
64
|
+
It gets you only raw data. You must handle it on erb, haml, slim, etc for output without HTML escaping.
|
51
65
|
|
52
|
-
**Rails 4**
|
53
66
|
```ruby
|
54
|
-
VideoPlayer::player("http://vimeo.com/101419884")
|
55
|
-
# returns iframe player from Vimeo video
|
56
|
-
# <iframe src=\"//player.vimeo.com/video/101419884\" width=\"420\" height=\"315\" frameborder=\"0\"></iframe>
|
67
|
+
video = VideoPlayer::player("http://vimeo.com/101419884")
|
57
68
|
|
58
|
-
|
59
|
-
|
60
|
-
|
69
|
+
# erb
|
70
|
+
<%= video.html_safe %>
|
71
|
+
|
72
|
+
# haml, slim
|
73
|
+
= video.html_safe
|
74
|
+
# or
|
75
|
+
== video
|
61
76
|
```
|
62
77
|
|
78
|
+
|
63
79
|
<a name="contributing"></a>
|
64
80
|
## Contributing
|
65
81
|
1. Fork it ( https://github.com/tgezginis/video_player/fork )
|
data/lib/video_player/version.rb
CHANGED
data/lib/video_player.rb
CHANGED
@@ -17,7 +17,18 @@ module VideoPlayer
|
|
17
17
|
url.gsub(/https?:\/\/(www.)?vimeo\.com\/([A-Za-z0-9._%-]*)((\?|#)\S+)?/) do
|
18
18
|
vimeo_id = $2
|
19
19
|
frameborder = 0
|
20
|
-
return %{<iframe src="//player.vimeo.com/video/#{vimeo_id}" width="#{width}" height="#{height}" frameborder="
|
20
|
+
return %{<iframe src="//player.vimeo.com/video/#{vimeo_id}" width="#{width}" height="#{height}" frameborder="0"></iframe>}
|
21
|
+
end
|
22
|
+
elsif url.include? "izlesene"
|
23
|
+
regex = /^http:\/\/(?:.*?)\izlesene\.com\/video\/([\w\-\.]+[^#?\s]+)\/(.*)?$/i
|
24
|
+
url.gsub(regex) do
|
25
|
+
izlesene_video_id = $2
|
26
|
+
if autoplay
|
27
|
+
src = "//www.izlesene.com/embedplayer/#{izlesene_video_id}/?autoplay=1&showrel=0&showinfo=0"
|
28
|
+
else
|
29
|
+
src = "//www.izlesene.com/embedplayer/#{izlesene_video_id}/?autoplay=0&showrel=0&showinfo=0"
|
30
|
+
end
|
31
|
+
return %{<iframe width="#{width}" height="#{height}" src="#{src}" frameborder="0" allowfullscreen></iframe>}
|
21
32
|
end
|
22
33
|
else
|
23
34
|
return false
|
data/video_player.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = VideoPlayer::VERSION
|
9
9
|
spec.authors = ["Tolga Gezginiş"]
|
10
10
|
spec.email = ["tolga@gezginis.com"]
|
11
|
-
spec.summary = %q{Video player for Youtube and
|
12
|
-
spec.description = %q{Create video player for Youtube and
|
11
|
+
spec.summary = %q{Video player for Youtube, Vimeo and İzlesene}
|
12
|
+
spec.description = %q{Create video player for Youtube, Vimeo and İzlesene videos}
|
13
13
|
spec.homepage = "https://github.com/tgezginis/video_player"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: video_player
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tolga Gezginiş
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description: Create video player for Youtube and
|
41
|
+
description: Create video player for Youtube, Vimeo and İzlesene videos
|
42
42
|
email:
|
43
43
|
- tolga@gezginis.com
|
44
44
|
executables: []
|
@@ -76,5 +76,5 @@ rubyforge_project:
|
|
76
76
|
rubygems_version: 2.4.3
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
|
-
summary: Video player for Youtube and
|
79
|
+
summary: Video player for Youtube, Vimeo and İzlesene
|
80
80
|
test_files: []
|