WMP WIN32OLE in Ruby/IRB problem

The following code plays the playlist thourgh IRB in FXRI, but playback
doesn’t start when using IRB from the command line.

oPlayer = WIN32OLE.new(“WMPlayer.ocx.7”)
oPlayer.Settings.autoStart = 1
oPlayListCollection = oPlayer.PlayListCollection.GetAll()
oPlayer.currentPlaylist = oPlayListCollection.item(0) #plays in FXRI,
nothing happens in IRB

also

oPlayer.Controls.play # doesn’t work in IRB either.

I’m a newbie, so maybe I’m missing something obvious? any thoughts
appreciated.

Mike wrote:

The following code plays the playlist thourgh IRB in FXRI, but playback
doesn’t start when using IRB from the command line.

oPlayer = WIN32OLE.new(“WMPlayer.ocx.7”)
oPlayer.Settings.autoStart = 1
oPlayListCollection = oPlayer.PlayListCollection.GetAll()
oPlayer.currentPlaylist = oPlayListCollection.item(0) #plays in FXRI,
nothing happens in IRB

also

oPlayer.Controls.play # doesn’t work in IRB either.

I’m a newbie, so maybe I’m missing something obvious? any thoughts
appreciated.

I’m seeing the same problem here. I thought it was something funky that
IRB is doing, or not doing. Then I cobbled-up a script and ran it…
still doesn’t play. The only way I could get anything to play was by
using the .openPlayer() method.

oPlayer.openPlayer(<my .mp3 file>)

I added the following line after the one that assigns the
.currentPlayList property…

puts(“Playing track “#{oPlayer.currentMedia.name}” from the
“#{oPlayer.currentPlayList.name}” playlist”)

which spits out something like:
Playing track “Mix 04-05” from the “All Music” playlist

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs