-
- VBForums
- Visual Basic
- Visual Basic 6 and Earlier
- vb media player - next song automatically
-
Jan 5th, 2008,02:16 PM #1 Thread Starter New Member vb media player - next song automatically Hi, I am a quite experiences programmer and started coding a vb media player yesterday. Its basically done apart from i cant get the player to automatically load the next song. I have done a search of this forum but none of the previous responses seem to work. Heres the code : Private Sub WMP_StatusChange() If WMP.playState = wmppsMediaEnded Then If OptOn.Value = True Then filecount = File1.ListCount chosenfile = Int(Rnd * filecount) + 1 'generate random index File1.Selected(chosenfile) = True filename = Dir1.Path & "\" & File1.filename WMP.URL = filename Else fileindex = File1.ListIndex fileindex = fileindex + 1 File1.Selected(fileindex) = True 'plays next index filename = Dir1.Path & "\" & File1.filename WMP.URL = filename End If End If End Sub I have tried different events as well like playstatechange but no luck. The very annoying thing is that an identical piece of code works on a button click. Any response would be appreciated Thanks in advance Juggler -
Jan 5th, 2008,02:20 PM #2 Re: vb media player - next song automatically How about using a Play List? VB/Office Guru� (AKA: Gangsta Yoda� � ) I dont answer coding questions via PM. Please post a thread in the appropriate forum. Microsoft MVP 2006-2011 Office Development FAQ (C#, VB.NET, VB 6, VBA) Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET If a post has helped you then Please Rate it! � Reps & Rating Posts � VS.NET on Vista � Multiple .NET Framework Versions � Office Primary Interop Assemblies � VB/Office Guru� Word SpellChecker�.NET � VB/Office Guru� Word SpellChecker� VB6 � VB.NET Attributes Ex. � Outlook Global Address List � API Viewer utility � .NET API Viewer Utility � System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 -
Jan 5th, 2008,02:23 PM #3 Thread Starter New Member Re: vb media player - next song automatically if you mean a pre-determined list of songs to run through that is not what i am after. Can you see any prob with the code and any suggestion why it will work onclick but not on any media event i have tried so far. Juggler -
Jan 5th, 2008,03:33 PM #4 Re: vb media player - next song automatically Ok I think what you should be doing is generating a temporary playlist that you can generate from your files in the selected directory. Then assign the new temp playlist as the active list and play it. .newPlaylist "MyTempPlaylist1", "C:\SomeFolder\TempList1.wpl" .settings.setMode wmppsPlaying, True This is how most sites do it with those continuous playing of videos. VB/Office Guru� (AKA: Gangsta Yoda� � ) I dont answer coding questions via PM. Please post a thread in the appropriate forum. Microsoft MVP 2006-2011 Office Development FAQ (C#, VB.NET, VB 6, VBA) Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET If a post has helped you then Please Rate it! � Reps & Rating Posts � VS.NET on Vista � Multiple .NET Framework Versions � Office Primary Interop Assemblies � VB/Office Guru� Word SpellChecker�.NET � VB/Office Guru� Word SpellChecker� VB6 � VB.NET Attributes Ex. � Outlook Global Address List � API Viewer utility � .NET API Viewer Utility � System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 -
Jan 6th, 2008,12:06 PM #5 Thread Starter New Member Re: vb media player - next song automatically ok thanks. I will have a play and let you know the outcome. cheers - juggler -
Jan 6th, 2008,02:18 PM #6 Re: vb media player - next song automatically VB/Office Guru� (AKA: Gangsta Yoda� � ) I dont answer coding questions via PM. Please post a thread in the appropriate forum. Microsoft MVP 2006-2011 Office Development FAQ (C#, VB.NET, VB 6, VBA) Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET If a post has helped you then Please Rate it! � Reps & Rating Posts � VS.NET on Vista � Multiple .NET Framework Versions � Office Primary Interop Assemblies � VB/Office Guru� Word SpellChecker�.NET � VB/Office Guru� Word SpellChecker� VB6 � VB.NET Attributes Ex. � Outlook Global Address List � API Viewer utility � .NET API Viewer Utility � System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 -
Jan 6th, 2008,03:19 PM #7 Thread Starter New Member Re: vb media player - next song automatically had a play but no luck. So it is possible to put all the mp3 files in one directory into a playlist on form load. If so could you maybe post some code to get me started, if you know it that is. Thanks Juggler -
Jan 6th, 2008,07:07 PM #8 Re: vb media player - next song automatically Write out your playlist file in this format after you read in the files in your directory. Playlist format: Code: <?wpl version="1.0"?> <smil> <head> <meta name="Generator" content="Microsoft Windows Media Player -- 11.0.6000.6344"/> <meta name="AverageRating" content="33"/> <meta name="TotalDuration" content="111"/> <meta name="ItemCount" content="3"/> <meta name="ContentPartnerListID"/> <meta name="ContentPartnerNameType"/> <meta name="ContentPartnerName"/> <meta name="Subtitle"/> <author/> <title>Test</title> </head> <body> <seq> <media src="Video1.wmv"/> <media src="Video2.wmv"/> <media src="Video3.wmv" /> </seq> </body> </smil> The to load/play it: Code: Option Explicit Private Sub Form_Load() WMP.URL = "C:\Users\UserName\Videos\Test.wpl" End Sub VB/Office Guru� (AKA: Gangsta Yoda� � ) I dont answer coding questions via PM. Please post a thread in the appropriate forum. Microsoft MVP 2006-2011 Office Development FAQ (C#, VB.NET, VB 6, VBA) Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET If a post has helped you then Please Rate it! � Reps & Rating Posts � VS.NET on Vista � Multiple .NET Framework Versions � Office Primary Interop Assemblies � VB/Office Guru� Word SpellChecker�.NET � VB/Office Guru� Word SpellChecker� VB6 � VB.NET Attributes Ex. � Outlook Global Address List � API Viewer utility � .NET API Viewer Utility � System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 -
Jan 6th, 2008,07:35 PM #9 Re: vb media player - next song automatically Seems you need to invoke the play too. Code: Option Explicit Private Sub Form_Load() On Error GoTo My_Error WMP.URL = "C:\Users\UserName\Videos\Test.wpl" WMP.Controls.play Exit Sub My_Error: MsgBox Err.Number & " - " & Err.Description, vbOKOnly + vbExclamation End Sub VB/Office Guru� (AKA: Gangsta Yoda� � ) I dont answer coding questions via PM. Please post a thread in the appropriate forum. Microsoft MVP 2006-2011 Office Development FAQ (C#, VB.NET, VB 6, VBA) Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET If a post has helped you then Please Rate it! � Reps & Rating Posts � VS.NET on Vista � Multiple .NET Framework Versions � Office Primary Interop Assemblies � VB/Office Guru� Word SpellChecker�.NET � VB/Office Guru� Word SpellChecker� VB6 � VB.NET Attributes Ex. � Outlook Global Address List � API Viewer utility � .NET API Viewer Utility � System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 -
Nov 22nd, 2013,09:44 AM #10 New Member Media Player Play Next Song Automatically How to create media player with play next song automatically Timer1.Tick Timer1.Start() If Me.AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then ListBox1.SelectedIndex = (Index Mod ListBox1.Items.Count) Index += 1 AxWindowsMediaPlayer1.URL = ListBox1.SelectedItem AxWindowsMediaPlayer1.Ctlcontrols.play() End If This is the code Codes By Sricharan Last edited by Siddharth Rout; Nov 24th, 2013 at 05:31 AM. -
Nov 22nd, 2013,04:20 PM #11 Re: vb media player - next song automatically This sample media player uses msdxm.ocx (included unless moderator removed it). It uses a Play list Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes. -
Nov 24th, 2013,05:32 AM #12 Re: vb media player - next song automatically @Sricharan: Welcome to the forums. I have deleted the attachment from your post as it contained an executable file. When ever you upload attachments in vbforums, please ensure that it doesn't have an executable file in it. Also this thread is for Visual Basic 6 so your code actually is of no use A good exercise for the Heart is to bend down and help another up... Please Mark your Thread " Resolved", if the query is solved MyGear : ★ CPU ★ Ryzen 5 5800X ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X) ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor ★ Keyboard ★ TVS Electronics Gold Keyboard ★ Mouse ★ Logitech G502 Hero -
- VBForums
- Visual Basic
- Visual Basic 6 and Earlier
- vb media player - next song automatically
Posting Permissions - You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
- BB code is On
- Smilies are On
- [IMG] code is On
- [VIDEO] code is On
- HTML code is Off
Forum Rules | Click Here to Expand Forum to Full Width |
0 Response to "How to Make Songs Play Continuously on Visual Basic"
Post a Comment