01-20-2026, 06:01 AM
Another demo written on the Library. Using the CALLBACK feature.
The code (requires SPV Vid Library above)
The code (requires SPV Vid Library above)
Code: (Select All)
$Resize:On
Option _Explicit
' IF FRAME_CALLBACK IS ON THEN THE SUB
' FRAME_CALLBACK WILL BE CALLED FOR EACH FRAME OF THE VIDEO
' REMOVING THE DEFINE FOR FRAME_CALLBACK TURNS THIS OFF
' THE SUB FRAME_CALLBACK Is defined by the end Developer
$Let FRAME_CALLBACK = "ON"
' If this DEFINE is used then a User function
' V_Custom_Controller& that should return type LONG is used instead of
' _keyhit for video playback. Should return the same as _keyhit control
' _key_spc - Pause
' _key_esc - End (and bookmark if bookmarking is on)
' _key_left - Seek back four seconds
' _key_right - Seek forward four seconds
' _key_up, _key_down PCM volume control
' M key Mutes Audio
' L key pops up the Key control Legend
' T key toggles Video Countdown Timer display
' If you do not want the Popup Messages on the Video Image then
' Set VID_LEGENDS_OFF to _True
' $Include: './SPV-VIDS.BI'
Dim BG As Long
Dim Shared XWid As Long
Dim Shared YHei As Long
Dim Shared XInc As Integer
Dim Shared YInc As Integer
Dim Shared XBounce As Integer
Dim Shared YBounce As Integer
Dim Shared AppleImg As Long
Randomize Timer
XWid = 1024
YHei = 768
XInc = Int(Rnd * 6) + 1
YInc = Int(Rnd * 6) + 1
GETVIDEO:
' With this on Video will Bookmark current Frame to a .MARK
' File. When next played (if Bookmarking ON) Play will resume at
' The Bookmark. If BookMarking is OFF then Video plays from beginning
' and no bookmark is saved when ESC is pressed.
TURNON_BOOKMARKING
_Title "SPV Video Selection"
VIDEO_FILE$ = _OpenFileDialog$("SIMPLE X16 MOVIE PLAYER - Select SPV Video File(s) to Play", "", "*.SPV|*.spv", "X16 Movie Files", 0)
If BG <> 0 Then
Screen 0
_FreeImage BG
_Display
End If
' Video_XOrigin = XOrg
' Video_YOrigin = YOrg
' VIDEO_WINDOW_WIDTH = VWidth
' VIDEO_WINDOW_HEIGHT = INT(VWidth * .75)
' This player selects proper resolution and background for Widescreen and 4:3 Videos
' In the Call to WINDOWED_VIDEO only the Width is specified, Height is calculated properly
' For the Video ASPECT Ration
If OpenVideo(VIDEO_FILE$) Then
BG = _NewImage(XWid, YHei, 32)
Screen BG
_PrintMode _KeepBackground
Color _RGB32(10, 10, 10, 255)
_PrintString (10, _Height - 20), "L - Shows a Player Control Legend"
_PrintMode _FillBackground
Color _RGB32(255, 255, 255, 255)
_Resize On
WINDOWED_VIDEO 0, 0, .4 * XWid
XBounce = XWid - VIDEO_WINDOW_WIDTH
YBounce = YHei - VIDEO_WINDOW_HEIGHT
PlayTheVideo
CLEAN_UP_VIDEO
GoTo GETVIDEO
End If
System
' The below sub is the frame CALLBACK
Sub FRAME_CALLBACK
' Line (VIDEO_XOrigin, VIDEO_YOrigin)-(VIDEO_XOrigin + VIDEO_WINDOW_WIDTH, VIDEO_YOrigin + VIDEO_WINDOW_HEIGHT), &HFF000000, BF
_PutImage , FRAME_IMAGE
VIDEO_XOrigin = VIDEO_XOrigin + XInc
If VIDEO_XOrigin < 0 Then
VIDEO_XOrigin = 0
XInc = Int(Rnd * 6) + 1
End If
If VIDEO_XOrigin > XBounce Then
VIDEO_XOrigin = XBounce
XInc = (Int(Rnd * 6) + 1) * -1
End If
VIDEO_YOrigin = VIDEO_YOrigin + YInc
If VIDEO_YOrigin < 0 Then
VIDEO_YOrigin = 0
YInc = Int(Rnd * 6) + 1
End If
If VIDEO_YOrigin > YBounce Then
VIDEO_YOrigin = YBounce
YInc = (Int(Rnd * 6) + 1) * -1
End If
End Sub
' $Include: './SPV-VIDS.BM'

