Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SPV Video library.
#9
Another demo written on the Library.    Using the CALLBACK feature.

   

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'
Reply


Messages In This Thread
SPV Video library. - by ahenry3068 - 01-16-2026, 02:53 PM
RE: SPV Video library. - by vince - 01-19-2026, 05:33 PM
RE: SPV Video library. - by ahenry3068 - 01-19-2026, 05:58 PM
RE: SPV Video library. - by Pete - 01-19-2026, 05:46 PM
RE: SPV Video library. - by Pete - 01-19-2026, 06:37 PM
RE: SPV Video library. - by ahenry3068 - 01-19-2026, 09:48 PM
RE: SPV Video library. - by SMcNeill - 01-20-2026, 12:52 AM
RE: SPV Video library. - by ahenry3068 - 01-20-2026, 02:53 AM
RE: SPV Video library. - by ahenry3068 - 01-20-2026, 06:01 AM
RE: SPV Video library. - by ahenry3068 - 01-20-2026, 04:57 PM
RE: SPV Video library. - by ahenry3068 - 01-21-2026, 06:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Format Library eoredson 8 442 02-28-2026, 03:31 AM
Last Post: eoredson
  layoutUtils (library for text layout) Herve 5 1,143 07-19-2025, 12:37 AM
Last Post: Herve
  Large 2D Graphics Library TarotRedhand 6 2,602 12-05-2023, 05:17 AM
Last Post: grymmjack
  Huge Matrices Library [Updated] TarotRedhand 8 2,627 05-17-2022, 11:42 AM
Last Post: TarotRedhand

Forum Jump:


Users browsing this thread: 1 Guest(s)