XBMC volume rule

Hi I am trying to change of an opened .mp4 file hosted on the internet.

I have been able to open the .mp4 but am not sure of the code for setting the volume.

What I have so far is:

  Source = "http://www.{website}.co.uk/music/music1.mp4"
  sendCommand(htpc_OpenMedia, Source)  

{website} - website url name

If you have an item bound like this:

Dimmer TvVolume "TV Volume [%.1f]" { xbmc="=[#yourtv|Application.Volume]" }

you should be able to

sendCommand(TvVolume, "50")

to set the volume to half volume, for example.

1 Like

Hi watou,

Thank you for your comment, I have the item set as you suggested.

I will try to do something like this, so that the volume will gradually increase, does the volume need to be hard coded in your example as a string or can it be in a variable like my example?

var Number VolumeStep

  VolumeStep = 10
     VolumeStep = VolumeStep + 1
     sendCommand(htpc_volume, VolumeStep )


That should work I think, but sleeping for only 70 milliseconds is really short! I think you would want a longer delay or a bigger step-up in volume or both, or you will have sent ~40 command events over a period of 2.8 seconds, which might be pushing your luck (I haven’t tried it so maybe it’s OK), but I think a larger volume step at least is a good idea.

Thank you

I will try and implement the code this evening and let you know how things go.

Many Thanks