sensible-cinema 0.28.0 → 0.28.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/LICENSE.TXT +1 -1
  2. data/README +6 -4
  3. data/Rakefile +41 -24
  4. data/TODO +41 -10
  5. data/VERSION +1 -1
  6. data/change_log_with_feature_list.txt +12 -0
  7. data/documentation/is_it_legal_to_copy_dvds.txt +4 -2
  8. data/go +1 -0
  9. data/goc +1 -0
  10. data/history_and_related_works_list.txt +2 -0
  11. data/inventionzy_files/control_youtube.html +135 -0
  12. data/inventionzy_files/md5s.txt +53 -0
  13. data/inventionzy_files/play_with_inserted_scene.bat +8 -0
  14. data/inventionzy_files/play_with_overlay.bat +24 -0
  15. data/inventionzy_files/serve.rb +6 -0
  16. data/inventionzy_files/transcript_mute_vlc.txt +117 -0
  17. data/lib/add_any_bundled_gems_to_load_path.rb +1 -1
  18. data/lib/edl_parser.rb +2 -0
  19. data/lib/gui/sensible-cinema-base.rb +10 -68
  20. data/lib/gui/sensible-cinema-create.rb +16 -10
  21. data/lib/gui/sensible-cinema-dependencies.rb +1 -0
  22. data/lib/gui/sensible-cinema-normal.rb +11 -14
  23. data/lib/muter.rb +1 -1
  24. data/lib/subtitle_profanity_finder.rb +3 -2
  25. data/spec/notes +2 -0
  26. data/template_bats/README_DISTRO.TXT +6 -0
  27. data/template_bats/mac/RUN SENSIBLE CINEMA CLICK HERE.sh b/data/template_bats/mac/RUN SENSIBLE CINEMA CLICK → HERE.command +0 -0
  28. data/template_bats/mac/{advanced--create or edit sensible cinema edit list files.sh → advanced--create or edit sensible cinema edit list files.command } +1 -0
  29. data/template_bats/mac/{advanced--run-upconverting-video-player.sh → advanced--run-upconverting-video-player.command} +1 -0
  30. data/todo.inventionzy.txt +11 -0
  31. data/todo.propaganda +21 -18
  32. data/vendor/rdp-win32screenshot-0.0.9/.document +5 -0
  33. data/vendor/rdp-win32screenshot-0.0.9/History.rdoc +53 -0
  34. data/vendor/rdp-win32screenshot-0.0.9/LICENSE +20 -0
  35. data/vendor/rdp-win32screenshot-0.0.9/RDP_BRANCH_HAS_MASTER_WITH_CORRECT_VERSION_NUMBER +0 -0
  36. data/vendor/rdp-win32screenshot-0.0.9/RDP_VERSION_IS_IN_RDP_BRANCH +0 -0
  37. data/vendor/rdp-win32screenshot-0.0.9/README.rdoc +95 -0
  38. data/vendor/rdp-win32screenshot-0.0.9/Rakefile +63 -0
  39. data/vendor/rdp-win32screenshot-0.0.9/VERSION +1 -0
  40. data/vendor/rdp-win32screenshot-0.0.9/enumerated +55576 -0
  41. data/vendor/rdp-win32screenshot-0.0.9/lib/aero_offscreen_srccopy_captureblt_doesnt_have_everything.bmp.gz +0 -0
  42. data/vendor/rdp-win32screenshot-0.0.9/lib/enumerate.rb +6 -0
  43. data/vendor/rdp-win32screenshot-0.0.9/lib/firefox.bmp +0 -0
  44. data/vendor/rdp-win32screenshot-0.0.9/lib/normal.bmp +0 -0
  45. data/vendor/rdp-win32screenshot-0.0.9/lib/normal2.bmp +0 -0
  46. data/vendor/rdp-win32screenshot-0.0.9/lib/notes +5 -0
  47. data/vendor/rdp-win32screenshot-0.0.9/lib/snapshot.rb +10 -0
  48. data/vendor/rdp-win32screenshot-0.0.9/lib/srccopy.bmp +0 -0
  49. data/vendor/rdp-win32screenshot-0.0.9/lib/srccopyplus.bmp +0 -0
  50. data/vendor/rdp-win32screenshot-0.0.9/lib/srccopyplusdirectx.bmp +0 -0
  51. data/vendor/rdp-win32screenshot-0.0.9/lib/vc.bmp +0 -0
  52. data/vendor/rdp-win32screenshot-0.0.9/lib/win32/screenshot.rb +95 -0
  53. data/vendor/rdp-win32screenshot-0.0.9/lib/win32/screenshot/bitmap_maker.rb +200 -0
  54. data/vendor/rdp-win32screenshot-0.0.9/lib/win32/util.rb +93 -0
  55. data/vendor/rdp-win32screenshot-0.0.9/spec/spec.opts +1 -0
  56. data/vendor/rdp-win32screenshot-0.0.9/spec/spec_helper.rb +85 -0
  57. data/vendor/rdp-win32screenshot-0.0.9/spec/win32_screenshot_spec.rb +194 -0
  58. data/vendor/rdp-win32screenshot-0.0.9/spec/win32_screenshot_util_spec.rb +75 -0
  59. data/vendor/rdp-win32screenshot-0.0.9/win32screenshot.gemspec +69 -0
  60. data/{subfont.ttf → vendor/subfont.ttf} +0 -0
  61. data/zamples/edit_decision_lists/dvds/{edls_being_edited/cars_disney.txt → cars_disney.txt} +0 -0
  62. data/zamples/edit_decision_lists/dvds/edls_being_edited/king_of_kings.txt +28 -0
  63. data/zamples/edit_decision_lists/dvds/monsters_vs_aliens.txt +41 -0
  64. data/zamples/edit_decision_lists/dvds/peter_pan.txt +29 -0
  65. data/zamples/edit_decision_lists/dvds/speed_racer.txt +47 -0
  66. data/zamples/edit_decision_lists/notes/tron.txt +4 -0
  67. metadata +77 -54
  68. data/go.sh +0 -1
  69. data/legal2 +0 -3
  70. data/lib/play_audio.rb +0 -58
  71. data/lib/ruby_clip.rb +0 -26
  72. data/template_bats/RUN SENSIBLE CINEMA CLICK HERE.bat +0 -25
  73. data/template_bats/advanced--create or edit sensible cinema edit list files.bat +0 -1
  74. data/template_bats/advanced--run-upconverting-video-player.bat +0 -1
  75. data/transparent.png +0 -0
@@ -5,7 +5,7 @@ All files released under the GPLv3 license [1] unless otherwise specified. Ping
5
5
  EDL (delete list/edit list/EDL) files are released under the Creative Commons License, however.
6
6
 
7
7
  Note: may call out to some 3rd party libraries/executables under their own (separate, open source) licenses and distributions, but they are contained
8
- within this package for convenience.
8
+ packaged for convenience. They have their own source codes available.
9
9
 
10
10
  Note also that we used parts of the 7-Zip program, that 7-Zip is licensed under the GNU LGPL license, see http://www.7-zip.org, where its source code can be found.
11
11
 
data/README CHANGED
@@ -1,8 +1,10 @@
1
- This is a README for the Sensible Cinema edited movie playback player
2
- for its other aspects like upconverting DVD/Netflix Instant player please see
3
- http://rogerdpack.t28.net/sensible-cinema/
1
+ This is a README description for the Sensible Cinema edited movie playback portion of the player
2
+ for its other aspects like upconverting DVD/Netflix Instant please see
3
+ http://rogerdpack.t28.net/sensible-cinema for a description.
4
4
 
5
- ===
5
+ For installation instructions, see http://rogerdpack.t28.net/sensible-cinema
6
+
7
+ ===
6
8
 
7
9
  Sensible-cinema allows you to apply pre-programmed edit lists
8
10
  (e.g. Edit Decision Lists [2]) to the DVD's you own.
data/Rakefile CHANGED
@@ -10,14 +10,15 @@ Jeweler::Tasks.new do |s|
10
10
  s.homepage = "http://github.com/rdp"
11
11
  s.authors = ["Roger Pack"]
12
12
  s.add_dependency 'os', '>= 0.9.4'
13
- s.add_dependency 'sane', '>= 0.24.2'
14
- s.add_dependency 'rdp-win32screenshot', '= 0.0.9'
13
+ s.add_dependency 'sane', '>= 0.24.6'
14
+ # vendored s.add_dependency 'rdp-win32screenshot', '= 0.0.9'
15
15
  s.add_dependency 'mini_magick', '>= 3.1' # for ocr...
16
16
  s.add_dependency 'whichr', '>= 0.3.6'
17
- s.add_dependency 'rdp-rautomation', '> 0.6.3' # LODO
17
+ s.add_dependency 'rdp-rautomation', '> 0.6.3' # LODO use mainline with next release, though I can't remember why
18
18
  s.add_dependency 'rdp-ruby-wmi' # for windows
19
19
  s.add_dependency 'plist' # for mac
20
- s.add_dependency 'ffi' # mouse, etc. needed at least for windows MRI
20
+ # jruby-win32ole?
21
+ s.add_dependency 'ffi' # mouse, etc. needed for windows MRI, probably jruby too [windows]
21
22
  s.files.exclude '**/*.exe', '**/*.wav', '**/images/*'
22
23
  s.add_development_dependency 'hitimes' # now jruby compat!
23
24
  s.add_development_dependency 'rspec', '> 2'
@@ -66,6 +67,7 @@ def get_transitive_dependencies dependencies
66
67
  new_dependencies.flatten.uniq
67
68
  end
68
69
 
70
+ desc 'clear_and_copy_vendor_cache'
69
71
  task 'clear_and_copy_vendor_cache' do
70
72
  system("rm -rf ../cache.bak")
71
73
  system("cp -r vendor/cache ../cache.bak") # for retrieval later
@@ -102,25 +104,38 @@ task 'create_distro_dir' => :gemspec do # depends on gemspec...
102
104
  FileUtils.mkdir_p dir_out
103
105
  FileUtils.cp_r(existing, dir_out) # copies files, subdirs in
104
106
  # these belong in the parent dir, by themselves.
105
- FileUtils.cp(Dir["#{dir_out}/template_bats/*.bat"], "#{dir_out}/..")
106
- puts 'still not mac compatible OOTB'
107
- # FileUtils.cp_r(dir_out + '/template_bats/mac', dir_out)
108
- p 'created (still need to zip it) ' + dir_out
107
+ root_distro = "#{dir_out}/.."
108
+ FileUtils.cp_r(dir_out + '/template_bats/mac', root_distro) # the executable bit carries through somehow..
109
+ FileUtils.cp_r(dir_out + '/template_bats/pc', root_distro) # the executable bit carries through somehow..
110
+ FileUtils.cp('template_bats/README_DISTRO.TXT', root_distro)
111
+ p 'created (still need to zips it) ' + dir_out
109
112
  FileUtils.rm_rf Dir[dir_out + '/**/{spec}'] # don't need to distribute those..save 3M!
110
113
  end
111
114
 
115
+ def set_executable_bit filename
116
+ FileUtils.chmod 0755, filename
117
+ end
118
+
112
119
  def cur_ver
113
120
  File.read('VERSION').strip
114
121
  end
115
122
 
123
+ def delete_now_packaged_dir name
124
+ FileUtils.rm_rf name
125
+ end
126
+
127
+ desc 'create *.zip,tgz'
116
128
  task 'zip' do
117
129
  name = 'sensible-cinema-' + cur_ver
118
- raise unless File.directory? name
130
+ raise 'doesnt exist yet to zip?' unless File.directory? name
119
131
  raise unless system("\"c:\\Program Files\\7-Zip\\7z.exe\" a -tzip -r #{name}.zip #{name}")
120
- FileUtils.rm_rf name
121
- p 'created ' + name + '.zip, and deleted its [from] folder'
132
+ raise unless system("tar -cvzf #{name}.tgz #{name}")
133
+ delete_now_packaged_dir name
134
+ p 'created ' + name + '.zip,tgz and deleted its [create from] folder'
122
135
  end
123
136
 
137
+
138
+
124
139
  def sys arg
125
140
  3.times { |n|
126
141
  if n > 0
@@ -134,20 +149,22 @@ def sys arg
134
149
  end
135
150
 
136
151
  task 'deploy' do
137
- name = 'sensible-cinema-' + cur_ver + ".zip"
138
- p 'copying to ilab'
139
- sys "scp #{name} rdp@ilab1.cs.byu.edu:~/incoming"
140
- p 'creating sf shell'
141
- sys "ssh rdp@ilab1.cs.byu.edu 'ssh rogerdpack,sensible-cinema@shell.sourceforge.net create'" # needed for the next command to be able to work [weird]
142
- p 'creating sf dir'
143
- begin
144
- sys "ssh rdp@ilab1.cs.byu.edu 'ssh rogerdpack,sensible-cinema@shell.sourceforge.net \"mkdir /home/frs/project/s/se/sensible-cinema/#{cur_ver}\"'"
145
- rescue => ok_if_dir_already_existing
146
- puts 'warning--dir already existing?' + ok_if_dir_already_existing.to_s
152
+ for suffix in [ '.tgz', '.zip']
153
+ name = 'sensible-cinema-' + cur_ver + suffix
154
+ p 'copying to ilab'
155
+ sys "scp #{name} rdp@ilab1.cs.byu.edu:~/incoming"
156
+ p 'creating sf shell'
157
+ sys "ssh rdp@ilab1.cs.byu.edu 'ssh rogerdpack,sensible-cinema@shell.sourceforge.net create'" # needed for the next command to be able to work [weird]
158
+ p 'creating sf dir'
159
+ begin
160
+ sys "ssh rdp@ilab1.cs.byu.edu 'ssh rogerdpack,sensible-cinema@shell.sourceforge.net \"mkdir /home/frs/project/s/se/sensible-cinema/#{cur_ver}\"'"
161
+ rescue => ok_if_dir_already_existing
162
+ puts 'warning--dir already existing?' + ok_if_dir_already_existing.to_s
163
+ end
164
+ p 'copying into sf from ilab'
165
+ sys "ssh rdp@ilab1.cs.byu.edu 'scp ~/incoming/#{name} rogerdpack,sensible-cinema@frs.sourceforge.net:/home/frs/project/s/se/sensible-cinema/#{cur_ver}/#{name}'"
147
166
  end
148
- p 'copying into sf from ilab'
149
- sys "ssh rdp@ilab1.cs.byu.edu 'scp ~/incoming/#{name} rogerdpack,sensible-cinema@frs.sourceforge.net:/home/frs/project/s/se/sensible-cinema/#{cur_ver}/#{name}'"
150
- p 'successfully deployed to sf only! ' + cur_ver
167
+ p 'successfully deployed to sf! ' + cur_ver
151
168
  end
152
169
 
153
170
  task 'gem_release' do
data/TODO CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  remember this stuff is all "oh gosh I have to do that too?" crud time, don't even want it.
4
4
  and "won't even be useful to people in the end so why bother?"
5
+ "just for fun"
5
6
  netflix
6
7
  upconv netflix
7
8
  mac'ify OCR/Mouse
8
- upconvert DVD
9
- C EDL
10
9
 
11
10
  === non ordered/eventually (also add line items for them) ===
11
+ upconvert DVD
12
+ C EDL
12
13
  create a skype recorder
13
14
  netflix/skype "disable screen saver while running" program [?]
14
15
  linearize [?] hmm...
@@ -23,12 +24,11 @@
23
24
  == high prio like blocking bugs ==
24
25
 
25
26
  == next things I was working on ==
26
- unit tests work
27
+ gui/edl parser unit tests work
27
28
  screen recording sintel
28
- netflix instant CGI how good is their HD?
29
- Ben's DVD (hook)
30
29
 
31
30
  == yes do ordered for release/other projects ja ==
31
+ OSOH DVD timing for forum
32
32
  test out DVD upscale
33
33
  real "screen record" of upconverting sintel, see if it shows a difference
34
34
  see if I need to fix my capturer...
@@ -36,12 +36,28 @@
36
36
 
37
37
  netflix instant descriptor for OS X/work at all
38
38
  maybe get it to work with say VLC full screen first?
39
+ it may need the "50% adjuster" fella...
39
40
  netflix upconvert
40
41
  after get DVD down
41
- C player feedback message
42
+ after get hulu down
42
43
  nextsprocket...
43
44
 
44
45
  == yes do, un-ordered currently, from the various future release options ==
46
+
47
+ @ffplay: diagonal bug
48
+ fix surveillance for dual cams.
49
+ delete old files :P
50
+ re-encode them to maybe -r 0.5 ?
51
+ note...how to screen live movies :)
52
+ fix dropdown
53
+ note "netflix instant" on the www stuff once it works
54
+ netflix instant CGI how crisp is their HD?
55
+ C player feedback message
56
+ convert to 29.97 [at least this]
57
+ just with the "next" frame button I guess...
58
+ test if I have the same problem...
59
+ popup_text in EDL's
60
+ speed racer
45
61
  todo.upconvert
46
62
  netflix quality upconverter, have a go at it
47
63
  finalize screen capturer
@@ -50,25 +66,34 @@
50
66
  snapshots of Sintel "normal", then deploy the various comparison pics
51
67
  DVD test it (+- with others testing it for me too)
52
68
 
69
+ popup text for EDL's
70
+ inet22.net
71
+
53
72
  ri_for updatez
73
+ add button "check if EDL has valid syntax" ?
54
74
  subtitle -> url everywhere
75
+ they need/want to realize it's for contribution, not just use...
76
+ ooh here's a good idea.
77
+ force them to create any new EDL's on the wiki, and just read them, always, straight from there.
78
+ or some online gui thing, that would work too...prefer the latter
55
79
  english name (movie name) mass everywhere
56
80
  handle gates of he.....
57
81
  ruby_prof stuff
82
+ !additive for mplayer_dvd_splits
58
83
  warn other wordpresses
59
- legal2
60
84
  test mplayer -vo gl at home
61
85
  add new batch file for play with netflix OCR
62
86
  remove those extra printf's for scanning for matching
63
87
  Ben's other DVD's
64
88
  template-ify for netflix too "create for netflix"
65
- add netflix instant instructions,
89
+ add netflix instant instructions
66
90
  "note" competitor upconverters
67
91
  add a "record start stop" for screen capture
68
92
  that extra .5s DVD reports for file size...
69
93
  test DVD upconv it at 720*x resolution too...
70
94
  EDL gottman
71
95
  EDL Greg's DVD's
96
+ minor redcar tweaks
72
97
  opening/creating buttons -> new separate sub-window
73
98
  add a demo of conference "music video from local file"
74
99
  change upconvert options needs its own "close" button
@@ -79,6 +104,7 @@
79
104
  add new open button "edit EDL for current DVD"
80
105
  add "play at 1.5x speed" mplayer button, I guess
81
106
  short list of todo's for screen capture
107
+ @mplayer: Mutes on windows shtink
82
108
  "fix" mplayer EDL pausing (within the mplayer code itself)
83
109
  bounty it for now/test with latest ffmpeg et al, maybe on mac with source [?
84
110
  the open button should open in the "editing" EDL dir + save.
@@ -109,7 +135,7 @@
109
135
  maybe search at end of movies for certain things?
110
136
  double check--are my ffmpeg splits really really really the same as mplayer's EDL DVD splits? really?
111
137
  check with blu-rays...do they match timing-wise? sub-title wise? do subs match something else?
112
- youtube/hulu timings
138
+ youtube/hulu timings different?
113
139
  split LLC's website+consumer
114
140
  get LLC before a "real" domain name
115
141
  employee instructions: watch @ realtime after profanity filter first pass :P
@@ -165,8 +191,12 @@
165
191
  screen_capture TODO
166
192
 
167
193
  == DVD decide later to move up or down ==
194
+ super subtitle parser watcher for netflix instant...like on-demand...
168
195
 
169
196
  == DVD+-DVD-realtime backlog (totally unordered, some very low prio, basically all never do) ==
197
+ A netflix instant "coordinator" so you can watch a movie while on the phone et al :P (/hulu etc.)
198
+ bounty qtcapture for ffmpeg LOL/fix VLC
199
+ compare netflix instant HD to a blu-ray...same?
170
200
  split out the "dependency" codes
171
201
  more netflix instant timing
172
202
  do another srt comparison with netflix...see if it matches less 1s
@@ -249,7 +279,8 @@
249
279
  "save to" -> same dir as "get from" yeah
250
280
  figure out a way to get to the roku [ps3ms?], +- netflix edited to roku LOL
251
281
  prompt something if the EDL is actually "empty" :)
252
- already donated: sox, rubular, mplayer, vlc, menumeter, http://instantitunes.wordpress.com/2010/02/26/use-tsmuxer-on-snow-leopard, unlocker, mac fan thing, open office, many sourceforge tops, 7zip, VLC, mplayer, cannot donate: ffmpeg, http://ffmpeg.zeranoe.com/builds, tsmuxer (sent email), asked mulder, smplayer ($5), http://lame.buanzo.com.ar, sox, smcFanControl (eidac)
282
+ already donated: sox, rubular, mplayer, vlc, menumeter, http://instantitunes.wordpress.com/2010/02/26/use-tsmuxer-on-snow-leopard, unlocker, mac fan thing, open office, many sourceforge tops, 7zip, VLC, mplayer, cannot donate: ffmpeg, http://ffmpeg.zeranoe.com/builds, tsmuxer (sent email), asked mulder, smplayer ($5), http://lame.buanzo.com.ar, sox, smcFanControl (eidac), free flash webcam tester guy, argentine audacity liblame, VLC
283
+ todo: audacity, windirstat (done)
253
284
  note "you want to optimize your reverse blitting first... :)"
254
285
  if 2 EDL's, still can choose a title trackfor automatically playing it right.
255
286
  fast preview: change it to be aggressive sometimes yes, other times no
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.28.0
1
+ 0.28.1
@@ -1,3 +1,15 @@
1
+ == 0.28.1 ==
2
+
3
+ NB that we have auto-coordinating subtitle morphing software now
4
+ to automagically align it with the actual audio/video tracks.
5
+
6
+ Note also that it's possible to actually programmatically set the master volume control
7
+ (viz: Tron), see http://stackoverflow.com/questions/3249550/is-there-a-way-in-java-jna-to-set-the-master-system-volume-reliably-in-xpvi/7550110#7550110
8
+ and/or set it per application, through Windows Vista+
9
+ Also in XP: http://blogs.msdn.com/b/larryosterman/archive/2007/03/06/how-do-i-change-the-master-volume-in-windows-vista.aspx
10
+
11
+ First attempt at mac friendly release.
12
+
1
13
  == 0.28.0 ==
2
14
 
3
15
  Includes vendored support (experimental) for EDL playback via VLC via its internal libVLC control API
@@ -72,6 +72,8 @@ NB: YOU MUST AGREE TO THE gplv3 in order to use this software. See LICENSE.TXT
72
72
  [3] http://www.macworld.com/article/150731/2010/04/dvdripping_faqs.html
73
73
  [4] http://www.videolan.org/legal.html
74
74
 
75
- note also http://en.wikipedia.org/wiki/DVD_Decrypter for some more legal interestingnss.
75
+ http://en.wikipedia.org/wiki/DVD_Decrypter mentions fair use a bit, though in context of a different program, still interesting nonetheless.
76
76
 
77
- Also note that this project was done under the gplv3 in Roger's jurisdiction, not a product of anybody else or any other owner.
77
+ Also note that this project was done under the gplv3 in Roger's jurisdiction, not a product of anybody else or any other owner, nor copyright elsewise.
78
+
79
+ Also the footnotes to fanedit.org have some related and applicable discussion of legal issues.
data/go ADDED
@@ -0,0 +1 @@
1
+ jruby bin/sensible-cinema $1 $2 $3 $4 $5
data/goc ADDED
@@ -0,0 +1 @@
1
+ jruby bin/sensible-cinema $1 $2 $3 $4 $5 --create-mode
@@ -100,3 +100,5 @@ Anydvd HD's "magic file replacement" for DVD's/blu-ray's
100
100
  RiffTrax allows for an audio "overlay" to a DVD playback, have their own player to coordinate the two.
101
101
  "fan subs" are edited subtitles, displayed overlaid on the original track/video
102
102
  Avatar DVD was released with an audio track that was "euphemized" of the profanity.
103
+
104
+ BYU's Varsity theater used to edit movies, and show them.
@@ -0,0 +1,135 @@
1
+
2
+ <!--
3
+ You are free to copy and use this sample in accordance with the terms of the
4
+ Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
5
+ -->
6
+
7
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
8
+ <html xmlns="http://www.w3.org/1999/xhtml">
9
+ <head>
10
+ <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
11
+ <title>YouTube Player API Sample</title>
12
+ <style type="text/css">
13
+ #videoDiv {
14
+ margin-right: 3px;
15
+ }
16
+ #videoInfo {
17
+ margin-left: 3px;
18
+ }
19
+ </style>
20
+ <script src="http://www.google.com/jsapi" type="text/javascript"></script>
21
+ <script type="text/javascript">
22
+ google.load("swfobject", "2.1");
23
+ </script>
24
+ <script type="text/javascript">
25
+ /*
26
+ * Polling the player for information
27
+ */
28
+
29
+ // Update a particular HTML element with a new value
30
+ function updateHTML(elmId, value) {
31
+ document.getElementById(elmId).innerHTML = value;
32
+ }
33
+
34
+ // This function is called when an error is thrown by the player
35
+ function onPlayerError(errorCode) {
36
+ alert("An error occured of type:" + errorCode);
37
+ }
38
+
39
+ // This function is called when the player changes state
40
+ function onPlayerStateChange(newState) {
41
+ updateHTML("playerState", newState);
42
+ }
43
+
44
+
45
+ function pausecomp(millis)
46
+ {
47
+ var date = new Date();
48
+ var curDate = null;
49
+ do { curDate = new Date(); }
50
+ while(curDate-date < millis);
51
+ }
52
+
53
+ // we will mute from 2->10 seconds, and skip from second 13 to 18, wash and repeat
54
+ // have to run this from a web server for it to work
55
+
56
+ function muteFromSecondTwoToTen() {
57
+ ytplayer.mute();
58
+ setTimeout(
59
+ function() {
60
+ ytplayer.unMute();
61
+ setTimeout(
62
+ function() {
63
+ // here we're at second 13
64
+ // so let's seek to...say...1
65
+ ytplayer.seekTo(18, true);
66
+ }, 3000);
67
+ }, 8000);
68
+ }
69
+
70
+ var madeFirstTrans = false;
71
+
72
+ // Display information about the current state of the player
73
+ function updatePlayerInfo() {
74
+ // Also check that at least one function exists since when IE unloads the
75
+ // page, it will destroy the SWF before clearing the interval.
76
+
77
+ // mute from 5 to 10
78
+ // then skip from 15 to 20
79
+ if(ytplayer && ytplayer.getDuration) {
80
+ updateHTML("videoDuration", ytplayer.getDuration());
81
+ updateHTML("videoCurrentTime", ytplayer.getCurrentTime()); // this is it...
82
+ if(ytplayer.getCurrentTime() > 2 && !madeFirstTrans) {
83
+ muteFromSecondTwoToTen();
84
+ madeFirstTrans = true;
85
+ }
86
+ updateHTML("bytesTotal", ytplayer.getVideoBytesTotal());
87
+ updateHTML("startBytes", ytplayer.getVideoStartBytes());
88
+ updateHTML("bytesLoaded", ytplayer.getVideoBytesLoaded());
89
+ }
90
+ }
91
+
92
+ // This function is automatically called by the player once it loads
93
+ function onYouTubePlayerReady(playerId) {
94
+ ytplayer = document.getElementById("ytPlayer");
95
+ // This causes the updatePlayerInfo function to be called every 250ms to
96
+ // get fresh data from the player
97
+ setInterval(updatePlayerInfo, 25); // 25 ms
98
+ updatePlayerInfo();
99
+ ytplayer.addEventListener("onStateChange", "onPlayerStateChange");
100
+ ytplayer.addEventListener("onError", "onPlayerError");
101
+ }
102
+
103
+ // The "main method" of this sample. Called when someone clicks "Run".
104
+ function loadPlayer() {
105
+ // The video to load
106
+ var videoID = "ylLzyHk54Z0"
107
+ // Lets Flash from another domain call JavaScript
108
+ var params = { allowScriptAccess: "always" };
109
+ // The element id of the Flash embed
110
+ var atts = { id: "ytPlayer" };
111
+ // All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
112
+ swfobject.embedSWF("http://www.youtube.com/v/" + videoID +
113
+ "&enablejsapi=1&playerapiid=player1&autoplay=1",
114
+ "videoDiv", "480", "295", "8", null, null, params, atts);
115
+ }
116
+ function _run() {
117
+ loadPlayer();
118
+ }
119
+ google.setOnLoadCallback(_run);
120
+ </script>
121
+ </head>
122
+ <body style="font-family: Arial;border: 0 none;">
123
+ <table>
124
+ <tr>
125
+ <td><div id="videoDiv">Loading...</div></td>
126
+ <td valign="top">
127
+ <div id="videoInfo">
128
+ <p>Player state: <span id="playerState">--</span></p>
129
+ <p>Current Time: <span id="videoCurrentTime">--:--</span> | Duration: <span id="videoDuration">--:--</span></p>
130
+ <p>Bytes Total: <span id="bytesTotal">--</span> | Start Bytes: <span id="startBytes">--</span> | Bytes Loaded: <span id="bytesLoaded">--</span></p>
131
+ </div>
132
+ </td></tr>
133
+ </table>
134
+ </body>
135
+ </html>