I wrote a basic little app to allow me to play tunes from WMP on my PC
via Rails on my PocketPC. I select a tune, click play and the tune
plays until I hit the back button and playback stops! some of the code
below. Any Ideas why playback stops?
TIA
Mike
def PlayItem
i = params[:id]
@it = @@wmp.currentPl.item(i)
@@wmp.volume = 50
@@wmp.currentmedia = @it
Play()
# redirect_to :back
end
##Controller code
def PlayList
i = params[:id]
@nl = @pl.item(i)
@@wmp.volume = 50
@@wmp.currentPl = @nl
@@wmp.currentmedia = @@wmp.currentPl.item(1)
redirect_to :back
Play()
end
def Play
sleep(1)
$wmp.play
end
class WMPlayer
@@oPlayer = nil
@@oControls = nil
@@oCurrentPL = nil
@@oPlayListCollection = nil
def initialize
if not @@oPlayer
@@oPlayer = WIN32OLE.new("WMPlayer.ocx.7")
end
@@oPlayer
end
def currentmedia= oObj
@@oPlayer.currentmedia = oObj
end
def play
if @@oControls.isAvailable "play"
@@oControls.play
else
@@oControls.playItem @@oControls.currentItem
end
end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---