motion/media/player.rb in bubble-wrap-1.6.0 vs motion/media/player.rb in bubble-wrap-1.7.0
- old
+ new
@@ -62,20 +62,23 @@
# BW::Media::Player.play("http://www.hrupin.com/wp-content/uploads/mp3/testsong_20_sec.mp3") do |media_player|
# media_player.view.frame = some_view.bounds
# self.view.addSubview media_player.view
# end
def play(content_url, options = {}, &block)
+ options = {
+ delay_play: false
+ }.merge(options)
+
display_modal = !!options[:modal]
klass = display_modal ? MPMoviePlayerViewController : MPMoviePlayerController
content_url = content_url.is_a?(NSURL) ? content_url : NSURL.URLWithString(content_url)
@media_player = klass.alloc.initWithContentURL(content_url)
self.media_player.prepareToPlay if not display_modal
- options[:delay_play] = false if not options.has_key? :delay_play
set_player_options(options)
NSNotificationCenter.defaultCenter.observe MPMoviePlayerPlaybackDidFinishNotification do |notification|
h = notification.userInfo
error = h["error"]
@@ -142,6 +145,6 @@
self.media_player.shouldAutoplay = options[:should_autoplay] if options.has_key? :should_autoplay
self.media_player.useApplicationAudioSession = options[:use_application_audio_session] if options.has_key? :use_application_audio_session
end
end
end
-end
\ No newline at end of file
+end