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