Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Include NSNotificationCenter in require 'media'

Also change examples to not use `App.`, which is
only in `bw/core`.
  • Loading branch information...
commit 55edeb86e43508ad426880dd8c048a5f1cafdb55 1 parent b6a243e
@clayallsopp clayallsopp authored
View
2  README.md
@@ -354,7 +354,7 @@ Added wrapper for playing remote and local media. Available are `modal` and cust
```ruby
# Plays in your custom frame
-local_file = File.join(App.resources_path, 'test.mp3')
+local_file = File.join(NSBundle.mainBundle.resourcePath, 'test.mp3')
BW::Media.play(NSURL.fileURLWithPath(local_file)) do |media_player|
media_player.view.frame = [[10, 100], [100, 100]]
self.view.addSubview media_player.view
View
1  lib/bubble-wrap/media.rb
@@ -1,5 +1,6 @@
require 'bubble-wrap/loader'
BubbleWrap.require('motion/core/string.rb')
+BubbleWrap.require('motion/core/ns_notification_center.rb')
BubbleWrap.require('motion/media/**/*.rb') do
file('motion/media/media.rb').depends_on('motion/media/player.rb')
file('motion/media/player.rb').depends_on 'motion/core/string.rb'
View
2  motion/media/player.rb
@@ -81,7 +81,7 @@ def play(content_url, options = {}, &block)
end
}
- App.notification_center.observe MPMoviePlayerPlaybackDidFinishNotification do |notification|
+ NSNotificationCenter.defaultCenter.observe MPMoviePlayerPlaybackDidFinishNotification do |notification|
h = notification.userInfo
error = h["error"]
if error
Please sign in to comment.
Something went wrong with that request. Please try again.