VLC event members are actually properties, not functions.

Got the documentation wrong here, I was looking up examples and it looked as if calling the on* fields as functions was the right way to go but it was actually not. 64bf4ffc36/src/JsVlcPlayer.cpp (L90-L102) clearly defines as set-properties here.
develop
Icedream 2015-10-27 22:40:39 +01:00
parent e923f80333
commit 852052388d
1 changed files with 7 additions and 7 deletions

View File

@ -64,15 +64,15 @@ ts3clientService.on "started", (ts3proc) =>
ts3query = ts3clientService.query
# VLC event handling
vlc.onPlaying () =>
vlc.onPlaying = () =>
info = vlcMediaInfo[vlc.playlist.items[vlc.playlist.currentItem].mrl]
ts3query.sendtextmessage 2, 0, "Now playing [URL=#{info.originalUrl}]#{info.title}[/URL]."
vlc.onPaused () => ts3query.sendtextmessage 2, 0, "Paused."
vlc.onForward () => ts3query.sendtextmessage 2, 0, "Fast-forwarding..."
vlc.onBackward () => ts3query.sendtextmessage 2, 0, "Rewinding..."
vlc.onEncounteredError () => log.error "VLC has encountered an error! You will need to restart the bot.", arguments
vlc.onEndReached () => ts3query.sendtextmessage 2, 0, "End of playlist reached."
vlc.onStopped () => ts3query.sendtextmessage 2, 0, "Stopped."
vlc.onPaused = () => ts3query.sendtextmessage 2, 0, "Paused."
vlc.onForward = () => ts3query.sendtextmessage 2, 0, "Fast-forwarding..."
vlc.onBackward = () => ts3query.sendtextmessage 2, 0, "Rewinding..."
vlc.onEncounteredError = () => log.error "VLC has encountered an error! You will need to restart the bot.", arguments
vlc.onEndReached = () => ts3query.sendtextmessage 2, 0, "End of playlist reached."
vlc.onStopped = () => ts3query.sendtextmessage 2, 0, "Stopped."
ts3query.currentScHandlerID = 1
ts3query.mydata = {}