|
-
Mar 26th, 2025, 09:17 AM
#1
[VB6, twinBASIC] ucSimplePlayer: Simple video playback control
ucSimplePlayer v2.4.12

This is a simple video player UserControl for VB6, twinBASIC, and VBA, supporting both 32bit and 64bit. It's just a thin wrapper over the IMFPMediaPlayer media player control that's part of Windows Media Foundation. While MS recommends using IMFEngine, that doesn't support Windows 7.
All the basic features are covered:
- Play
- Pause
- Stop
- Volume
- Mute
- Balance
- Seek
- Playback rate
- Duration
- Fullscreen
The VB6 project file and ucSimplePlayDemo.twinproj have basic players implementing the control and its functions using the control as a UserControl.
ucSimplePlayer.twinproj is to compile an OCX which you could then use in VB6/tB plus other hosts like VBA 32bit/64bit.
It will automatically toggle full screen when you double click the video, to disable this change .AllowFullscreen to False. You can still use the manual toggle (.Fullscreen = True/False),
Requirements
Windows 7 or newer
VB6 (.ctl or .ocx), or
twinBASIC (.tbcontrol/.twin or .ocx)
VBA can only use this project as an OCX. Use twinBASIC to compile the OCX matching your Office bitness, or download the precompiled ocx from Releases. Tested in MS Office Excel 2021 64bit.
Note for OCX: If you compile it yourself using the free Community Edition of twinBASIC, the x64 ocx will show a splash screen when first loaded. Use the precompiled build or subscribe yourself to avoid this.
Download from project repository
Last edited by fafalone; May 19th, 2025 at 02:47 PM.
-
Mar 26th, 2025, 12:01 PM
#2
Fanatic Member
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
Very good project, I love it. It works very well.
There's one thing I really like about the players. I don't know if it can be implemented.
Thumbnail preview when you move the cursor over the slider. Would this be possible?
All the best
-
Mar 26th, 2025, 02:19 PM
#3
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
Doesn't look like there's a way through the simplified player here, but it should be possible to open another instance of the file based on the code used by the VideoThumbnails project (originally by -Franky- and modified for tB/WinDevLib/x64 by me). I'll give it a shot tonight.
-
Mar 29th, 2025, 12:14 PM
#4
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
PROJECT UPDATED: v2.2.5
New version adds stream selection (video and audio only, sorry this type of player doesn't seem to support subtitles), AR lock option, and timer for VBA people to keep playback position synced.
Code:
'Version 2.2.5
'-Added ability to select different video and audio streams:
' Use GetVideoStreams/GetAudioStreams to get the number and their
' names/languages, then use ActiveVideoStream/ActiveAudioStream
' properties to set the 1-based number of the active stream.
'-Added PreserveAspectRatio property (default True)
'-Added PlayerKeyUp and PlayerClick events
'-The Demo projects show how to use the above by showing a context menu
' when the player is right clicked, allowing you to switch tracks and
' toggle aspect ratio and fullscreen.
'-Added sub GetNativeSize to get original size of video w/o scaling
'-Added PlayTimer event to make it easy for VBA clients to synchronize
' a progress indicator, since there's no native Timer. Control with:
' .EnablePlayTimer
' .PlayTimerInterval (default 500ms)
-
Mar 29th, 2025, 02:13 PM
#5
Fanatic Member
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
good job master Fafalone thanks
-
May 18th, 2025, 01:23 AM
#6
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
Project Updated: v2.3.10

New version displays album art for audio only files, adds a wheel event, handles its own pause/unpause on click, can loop the current file, and more plus QoL improvements and bug fixes.
NOTE: The update of the VB6 UserControl version is still pending. I spent hours trying to work out a bug, couldn't, and didn't want to hold up the entire project anymore. The 32bit ocx is tested and working in VB6, and there's a VB6 demo player for it.
Code:
'Version 2.3.10
'-Album cover is now displayed when you play audio files; you can set
' ShowAlbumArt to False to disable this display.
'-A default image will be shown as album art if none could be loaded from
' the file, to disable, set UseDefaultAlbumArt to False, or to customize
' it, use SetDefaultAlbumArt and pass a byte array of an image file that
' is compatible with WIC.
' Tip: You can also use this as an audio only player by setting Visible
' to False
'-Added LoopPlayback property to automatically loop playback of the current
' item. The PlaybackEnded and a new start event are still fired at the end
' of each loop.
'-Added PlayerWheelScroll event. The demo app now shows how to use this
' to adjust the volume.
'-Player now pauses/unpauses on single left click. Set AllowPauseOnClick to
' False to disable this behavior.
'-Properties are now either hidden from the designer (settable at run
' time only), or properly saved/loaded. Ones still visible in the designer
' now have descriptions.
'-Added HasVideo property get.
'-Switched CopyMemory variant hack to more proper PropVariantClear.
'-(Bug fix) Duration and playback position not working when an audio-
' only file was played.
'-(Bug fix) Setting Paused to False did not change the status returned by
' that property.
'-(Demo) Added FLAC to Open Dialog types.
'-(Demo) File text now also has autocomplete.
'-(Demo) Click to pause/unpause.
'-(Demo) Support for mousewheel on volume and position sliders.
Download from project repository
Last edited by fafalone; May 20th, 2025 at 04:48 PM.
-
May 18th, 2025, 04:23 AM
#7
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
-
May 18th, 2025, 09:05 PM
#8
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
Project Updated: v2.4.11
This is a quick fix for possible crash-on-exit in 64bit due to a double-free. 32bit isn't affected on my machine, but if you're experiencing crash on exit this should fix that too.
VB6 .ctl version still pending, VanGoghGaming found a way to get it to draw, but now it's tearing on resize.
Code:
'Version 2.4.11 (19 May 2025)
'-Now using AlphaBlend instead of ImageList_Draw to render album art, as
' a partial workaround to the VB6 issue. (Thanks to VanGoghGaming for tip)
'-Now using SHCreateMemStream instead of CreateStreamOnHGlobal to satisfy
' VanGoghGaming.
'-(Bug fix) Double-free bug could cause crash on exit in x64.
Download from project repository
Precompiled binaries were updated too.
-
May 19th, 2025, 05:59 AM
#9
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
Project Updated - v2.4.12
The VB6 .ctl version is now posted; tB sources updated to match it. No other changes.
Code:
'Version 2.4.12 (19 May 2025)
'-Changes to make VB6 version finally work. (Thanks again to VanGoghGaming
' for help with this; graphics not my forté.)
Download from project repository
-
May 19th, 2025, 01:05 PM
#10
Fanatic Member
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
-
May 25th, 2025, 02:34 PM
#11
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
 Originally Posted by yokesee
Very good project, I love it. It works very well.
There's one thing I really like about the players. I don't know if it can be implemented.
Thumbnail preview when you move the cursor over the slider. Would this be possible?
All the best
I'm getting so close to this.
I've got a background thread creating thumbnails while the media plays, but right now it's rendering garbage. The colors match what I expect the frame to be, but its just lines. Done for today but it's coming with my advanced media player followup to this (along with subtitles and video effects). (This player is multithreaded in other ways too so probably won't be back-porting to VB6)
-
May 25th, 2025, 02:57 PM
#12
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
 Originally Posted by fafalone
I'm getting so close to this.
I've got a background thread creating thumbnails while the media plays, but right now it's rendering garbage. The colors match what I expect the frame to be, but its just lines.
If the garbage lines look something like this post then the issue is the stride not matching the width of the frame.
-
May 25th, 2025, 03:10 PM
#13
Re: [VB6, twinBASIC] ucSimplePlayer: Simple video playback control
The lines are vertical and half the box is blank but basically yeah. Thanks, will look into that.
Edit: Thumbnail generation now working! Still lots of control features to add but there's now a tracking tooltip (appears right away, stays open, and updates text as it moves) with the time above the cursor, and a small PictureBox that follows on the bottom with the thumbnail.
Last edited by fafalone; May 25th, 2025 at 09:42 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|