Jump to content

Change variable in existing object (shockwave flash)


Recommended Posts

Can I edit shockwave flash object's URL from one to other, while it's active and it's playing music?

If there's an object:

$oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$GUIActiveX = GUICtrlCreateObj( $oRP, 490, 8 , 80 , 20 )
$LinkoRP = ObjEvent($oRP,"IEEvent_","Preview")
  With $oRP
   .Movie = 'http://www.rainwave.tk/player/ffmp3-config.swf'
   .flashvars = 'url='&$var&'&codec=mp3&volume=75&introurl=&autoplay=true&tracking=false&jsevents=true&buffering=5&skin=ffmp3-rainwave.xml&title=OCRemix'
   .bgcolor = "#000000"
   .wmode = "Opaque"
   .allowscriptaccess = 'always'
   .scale = 'noscale'
  EndWith

As you can see, there is $var inside '.flashvars'. When I run this script, music plays, but when I'm changing the $var (using hotkey), nothing happens. How to play the music from $var = first link, then change $var to second link, and make it play the second link?

Edited by VixinG

[indent=3][/indent]

Link to comment
Share on other sites

Bump

All I want is to embed flash object to GUI with .movie, .flashvars, and few other things, and on button click, change only the ".flashvars", so it will play other URL - don't delete whole object, but only change single .flashvars to another, and refresh, so it will apply. Is that possible? I'm looking for solution since yesterday.

This is my embedded flash music player:

Func ObjectX()
$oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$GUIActiveX = GUICtrlCreateObj( $oRP, 490, 8 , 80 , 20 )
$LinkoRP = ObjEvent($oRP,"IEEvent_","Preview")
  With $oRP
   .Movie = 'http://www.rainwave.tk/player/ffmp3-config.swf'
   .flashvars = 'url='&$var&'&codec=mp3&volume=75&introurl=&autoplay=true&tracking=false&jsevents=true&buffering=5&skin=ffmp3-rainwave.xml&title=OCRemix'
   .bgcolor = "#000000"
   .wmode = "Opaque"
   .allowscriptaccess = 'always'
   .scale = 'noscale'
  EndWith
EndFunc

The .flashvars defines the url of music stream (eg. www.domain.com/music.mp3), and other options like autoplay and player's skin.

As you can see, there's a $var inside, which defines the 'url'. It's toggled by:

If $msg >= 11 And $msg <= 15 Then ; 11,12,13,14 and 15 are labels
   $a = $msg - 11
   $var = $urls[$a] ; $urls[0] to $urls[4] are music streams
   ObjectX() ; this is the function with "With $oRP ..... EndWith"
   _SetImage($pics[$x], $png2[$x]) ;set image to the button
   GetName() ;get name of currently played song
  EndIf

But it's working just one time... When I click other station, it doesn't change the stream - it still plays the 1st station.

Edited by VixinG

[indent=3][/indent]

Link to comment
Share on other sites

I think you need to provide a small working version of the script.

If this works initially there will be not much to find just by looking at the code pieces above.

It may also be a flash specific problem.

Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite
Link to comment
Share on other sites

For now it's deleting old object and creating new, with new url.. but I would like to change the "flashvars", instead of creating new object.

Just source (it is not working without other files - download full at the bottom):

;------------------------------------------------------------;
;  Rainwave Player by VixinG
;          ver 1.2
;------------------------------------------------------------;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <IE.au3>
#include 'Icons.au3'
#include <Inet.au3>
#include 'WinSnap.au3'
#include <StaticConstants.au3>
#include "Marquee.au3"
#include <Timers.au3>
;------------------------------------------------------------;
; Hotkeys
;------------------------------------------------------------;
$hotkey1 = IniRead('keys.ini', 'Hotkeys', 'Omniwave', '{F1}')
$hotkey2 = IniRead('keys.ini', 'Hotkeys', 'Rainwave', '{F2}')
$hotkey3 = IniRead('keys.ini', 'Hotkeys', 'Chiptune', '{F3}')
$hotkey4 = IniRead('keys.ini', 'Hotkeys', 'Covers', '{F4}')
$hotkey5 = IniRead('keys.ini', 'Hotkeys', 'OCRradio', '{F5}')
$topmost = IniRead('keys.ini', 'Hotkeys', 'SetOnTop', '{F6}')
HotKeySet($hotkey1, "omniwave")
HotKeySet($hotkey2, "rainwave")
HotKeySet($hotkey3, "bitwave")
HotKeySet($hotkey4, "mixwave")
HotKeySet($hotkey5, "ocr_radio")
HotKeySet($topmost, "TopMost")
HotKeySet("{ESC}", "Quit")
;------------------------------------------------------------;
; Declaring, registering, etc.
;------------------------------------------------------------;
Global $SetOnTop = True
Global $title = 'Click desired station... and enjoy the music!'
Dim $nr[5] = [5, 1, 4, 3, 2]
$GUI = GUICreate('Rainwave Player', 580, 37, 0, 0, $WS_POPUP)
$oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$GUIActiveX = GUICtrlCreateObj($oRP, 300, 300, 100, 30)
GUISetState(@SW_SHOW)
Dim $png1[5] = ['.artaa.png', '.artbb.png', '.artcc.png', '.artdd.png', '.artee.png']
Dim $png3[5] = ['.artaa.png', '.artbb.png', '.artcc.png', '.artdd.png', '.artee.png']
Dim $png2[5] = ['.artaa2.png', '.artbb2.png', '.artcc2.png', '.artdd2.png', '.artee2.png']
Global $dragLabel = GUICtrlCreateLabel('', 1, 1, 110, 33, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor($dragLabel, 0x000000)
_GUICtrlMarquee_SetScroll('', 'alternate', 'right', 1, 75)
_GUICtrlMarquee_SetDisplay(0, 0xf0ac20, 'black', 8, 'MS Reference Sans Serif')
Dim $pics[5] = [GUICtrlCreatePic('', 110, 1, 0, 0), GUICtrlCreatePic('', 154, 1, 0, 0), GUICtrlCreatePic('', 214, 1, 0, 0), GUICtrlCreatePic('', 310, 1, 0, 0), GUICtrlCreatePic('', 390, 1, 0, 0)]
Dim $urls[5] = ['http://omnistream.rainwave.cc:8000/omniwave.mp3', 'http://rwstream.rainwave.cc:8000/rainwave.mp3', 'http://bitstream.rainwave.cc:8000/bitwave.mp3', 'http://mwstream.rainwave.cc:8000/mixwave.mp3', 'http://ocrstream.rainwave.cc:8000/ocremix.mp3']
Local $disable
Global $00png = '.art00.png'
Global $00obj = GUICtrlCreatePic('', 1, 1, 0, 0)
_SetImage($00obj, $00png)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetBkColor(0x000000, $GUI)
_WinSnap_Set($GUI)
WinSetOnTop($GUI, "", 1)
;------------------------------------------------------------;
; Script
;------------------------------------------------------------;
Local $lastCursor
Refresh()
Dim $labels[5] = [GUICtrlCreateLabel('', 110, 1, 44, 23), GUICtrlCreateLabel('', 154, 1, 60, 23), GUICtrlCreateLabel('', 214, 1, 96, 23), GUICtrlCreateLabel('', 309, 1, 81, 23), GUICtrlCreateLabel('', 390, 1, 89, 23)]
For $i = 0 To 4 Step 1
GUICtrlSetBkColor($labels[$i], $GUI_BKCOLOR_TRANSPARENT)
Next
Local $highlighted = False
GUISetState(@SW_SHOW)
$marquee = _GUICtrlMarquee_Create($title, 110, 24, 369, 12, "")
While 1
$msg = GUIGetMsg()
$cursor = GUIGetCursorInfo($GUI)
If $cursor[4] >= 11 And $cursor[4] <= 15 Then
  $x = $cursor[4] - 11
  If $cursor[4] = $labels[$x] And $highlighted = False Then
   _SetImage($pics[$x], $png2[$x])
   $highlighted = True
   $oldx = $x
   $old = $cursor[4]
  EndIf
  If $highlighted = True And $cursor[4] <> $old Then
   _SetImage($pics[$oldx], $png1[$oldx])
   $highlighted = False
  EndIf
  If $msg >= 11 And $msg <= 15 Then
   AdlibUnRegister("GetName")
   AdlibRegister("GetName", 10000)
   $png1 = $png3
   $a = $msg - 11
   $var = $urls[$a]
   ObjectX()
   _SetImage($pics[$x], $png2[$x])
   $png1[$x] = $png2[$x]
   $x2 = $x
   $msg2 = $msg
   Refresh()
   GetName()
  EndIf
  If $msg >= 11 And $msg <= 15 And $msg <> $msg2 Then
   $png1 = $png3
   $var = $urls[$a]
   ObjectX()
   $png1[$x] = $png3[$x]
   _SetImage($pics[$x2], $png1[$x2])
   _SetImage($pics[$x], $png2[$x])
   $png1[$x] = $png2[$x]
   $x2 = $x
   $msg2 = $msg
   Refresh()
   GetName()
  EndIf
EndIf
If $cursor[4] = 0 And $highlighted = True Then
  Refresh()
EndIf
WEnd
Exit
;------------------------------------------------------------;
; Functions
;------------------------------------------------------------;
Func Refresh()
For $i = 0 To 4 Step 1
  _SetImage($pics[$i], $png1[$i])
  GUICtrlSetState($pics[$i], $GUI_DISABLE)
  $highlighted = False
Next
EndFunc   ;==>Refresh
Func TopMost()
If $SetOnTop = True Then
  WinSetOnTop($GUI, "", 0)
  $SetOnTop = False
Else
  WinSetOnTop($GUI, "", 1)
  $SetOnTop = True
EndIf
EndFunc   ;==>TopMost
Func omniwave()
$x = 0
$png1 = $png3
$var = $urls[0]
ObjectX()
_SetImage($pics[0], $png2[0])
$png1[0] = $png2[0]
Refresh()
GetName()
EndFunc   ;==>omniwave
Func rainwave()
$x = 1
$png1 = $png3
$var = $urls[1]
ObjectX()
_SetImage($pics[1], $png2[1])
$png1[1] = $png2[1]
Refresh()
GetName()
EndFunc   ;==>rainwave
Func bitwave()
$x = 2
$png1 = $png3
$var = $urls[2]
ObjectX()
_SetImage($pics[2], $png2[2])
$png1[2] = $png2[2]
Refresh()
GetName()
EndFunc   ;==>bitwave
Func mixwave()
$x = 3
$png1 = $png3
$var = $urls[3]
ObjectX()
_SetImage($pics[3], $png2[3])
$png1[3] = $png2[3]
Refresh()
GetName()
EndFunc   ;==>mixwave
Func ocr_radio()
$x = 4
$png1 = $png3
$var = $urls[4]
ObjectX()
_SetImage($pics[4], $png2[4])
$png1[4] = $png2[4]
Refresh()
GetName()
EndFunc   ;==>ocr_radio
Func Quit()
Exit
EndFunc   ;==>Quit
Func GetName()
$fullsource = _INetGetSource('http://rainwave.cc/async/' & $nr[$x2] & '/get', True)
$start = StringInStr($fullsource, 'sched_current') + 300
$source = StringMid($fullsource, $start, 300)
$start = StringInStr($source, 'song_title": "') + 14
$stop = StringInStr($source, '", "artists')
$length = $stop - $start
$title = StringMid($source, $start, $length)
$start = StringInStr($fullsource, 'sched_current') + 300
$source = StringMid($fullsource, $start, 750)
$start = StringInStr($source, 'album_name": "')
$source = StringMid($source, $start)
$start = StringInStr($source, 'album_name": "') + 14
$stop = StringInStr($source, '", "')
$length = $stop - $start
$album = StringMid($source, $start, $length)
$title = $title & ' - ' & $album
$sample = _GUICtrlMarquee_Create($title, 110, 24, 369, 12, "")
GUICtrlDelete($marquee)
$marquee = _GUICtrlMarquee_Create($title, 110, 24, 369, 12, "")
GUICtrlDelete($sample)
EndFunc   ;==>GetName
Func ObjectX()
GUICtrlDelete($GUIActiveX)
GUICtrlDelete($oRP)
$oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$GUIActiveX = GUICtrlCreateObj($oRP, 489, 8, 80, 20)
$LinkoRP = ObjEvent($oRP, "IEEvent_", "Preview")
GUISetState()
With $oRP
  .Movie = 'http://www.rainwave.tk/player/ffmp3-config.swf'
  .flashvars = 'url=' & $var & '&codec=mp3&volume=75&introurl=&autoplay=true&tracking=false&jsevents=true&buffering=5&skin=ffmp3-rainwave.xml'
  .bgcolor = "#000000"
  .wmode = "Opaque"
  .allowscriptaccess = 'always'
  .scale = 'noscale'
EndWith
EndFunc   ;==>ObjectX

Compiled + Source inside:

http://www.mediafire.com/?ejnm61rrxnn5ma7

Virus scan:

https://www.virustotal.com/file/df8aeab6f55a75737c023d040b9b3944db6aa38e2c26842c44b495ecac143246/analysis/1336949815/

[indent=3][/indent]

Link to comment
Share on other sites

Nice script.

Its most likely that this is an issue with the player. I dont know the internal flash object communication thing, but i think there has to be functions or at least documentation about this "ffmp3-config.swf" player what vars to set or to send if you want to stop or switch to another stream.

Recreating the object is what i had in mind too, but i cant provide any other solution, sorry.

Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite
Link to comment
Share on other sites

  • 3 years later...

I hope they are all still well :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...