Media+player+demo

'Basic embedded media player (tested only in IE7)

code mp3File$="b.mp3" 'change for valid url or path ' html " Now playing "+mp3File$+" Embedded media player. " code media MP3 player demo in browser. code cls dim music$(100) textarea #ta,("") files #bits, "C:\*.mp3" 'also wma,mid,avi,mpg etc c=1 while #bits hasanswer music$(c) = "C:\"+#bits name$ c=c+1 if c>100 then exit while wend print " " input "Enter track number to play: ";trackNum$ trackNum=val(trackNum$) if trackNum>0 and trackNum" cls print "Track now playing: ";music$(trackNum) print " " 'class ID for wmp6.4 (backwards compatible) 'see http://www.w3schools.com/media/media_playerref.asp for other clsid's html ""+play$+" " print " " link #fin, "Close", [quit] else print "Invalid tracknumber!" end if wait [quit] cls end code
 * 1) bits nextfile$
 * 1) ta println(c;" ";music$(c))

To test this out, copy a few MP3 files to C:\. before you start. Root dir chosen purely for simplicity and clarity.

code 'media player demo with listbox selection [start] cls dim music$(100) files #bits, "C:\*.mp3" 'also mid,wav,wma,avi,mpg ie anything wmp can play c=1 while #bits hasanswer music$(c) = "C:\"+#bits name$ c=c+1 if c>100 then exit while wend listbox #lb,music$,10 print " " link #sel, "[Play]",[go] link #fin, "[Close]",[quit] wait [go] trackNum$=#lb selection$ cls if trackNum$ <>"" then play$="" cls print " " print "Track now playing: ";trackNum$ print " " 'class ID for wmp6.4 (backwards compatible) 'see http://www.w3schools.com/media/media_playerref.asp for other clsid's html ""+play$+" " print " " link #res, "[Another]", [restart] link #fin, "[Close]", [quit] else goto [start] end if wait [restart] cls goto [start] [quit] cls end code
 * 1) bits nextfile$

Another player utilising listbox selection. (Tested only in IE7)

code 'Need to copy some mp3 tracks to the resources folder before running! dim mp3$(10) mp3$(1)="/resources/a.mp3" mp3$(2)="/resources/b.mp3" [start] cls Print "Select MP3 from list" print " & click 'Choose'" print listbox #lb1,mp3$,5 print:print link #sel, "[Choose]",[select] print wait [select] selected$=#lb1 selection$ if selected$<>"" then cls print "MP3 selected: ";selected$ print html "" html "" print:print link #rst, "[Another]",[start] end if wait code