FutureBasic Logo

<<    Index    >> FutureBasic

AVPlayerView   statement



Syntax
avplayerview tag, rect, controlsStyle, wndTag

Requires
Tlbx AVKit.incl header.
macOS 10.10+

Description
The avplayerview statement puts a new avplayerview in the current output window, or alters an existing avplayerview's characteristics.

Parameters
Parameter
Description
tag A number (1 through 1000000) that you assign when you create the avplayerview and that you refer to when altering the view. The number you assign must be different from the tag value of all other existing widgets in the current window. A negative tag hides the view.
rect The view's enclosing rectangle. This can be specified in either of two ways:
(i) (x,y,w,h) where x,y are the origin and w,h the size of the view.
(ii) A CGRect value
controlsStyle The style of the controls that appear over the view.
AVPlayerViewControlsStyleNone
AVPlayerViewControlsStyleInline
AVPlayerViewControlsStyleFloating
AVPlayerViewControlsStyleMinimal
AVPlayerViewControlsStyleDefault
(default)
wndTag An optional parameter for when the view's window is not the current output window. Note specifying this parameter does not bring the window to the front or make it the output window.
 

Example

include "Tlbx AVKit.incl" // required

_window = 1
begin enum 1
_playerView
_openFileBtn
end enum

void local fn OpenFile
AVPlayerRef player
CFURLRef url = openpanel 1, @"Open movie file", @"public.movie"
if ( url )
player = fn AVPlayerWithURL( url )
AVPlayerViewSetPlayer( _playerView, player )
AVPlayerPlay( player )
end if
end fn

void local fn BuildWindow
window _window, @"AVPlayerView", (0,0,623,536)
WindowSetContentMinSize( _window, fn CGSizeMake(176,100) )

avplayerview _playerView, (20,61,583,455)
ViewSetAutoresizingMask( _playerView, NSViewWidthSizable + NSViewHeightSizable )

button _openFileBtn,,, @"Open Movie Fileā€¦", (14,13,148,32)
ViewSetAutoresizingMask( _openFileBtn, NSViewMaxYMargin )
end fn

void local fn DoDialog( ev as long )
if ( ev == _btnClick ) then fn OpenFile
end fn

fn BuildWindow

on dialog fn DoDialog

HandleEvents

Apple documentation
AVPlayerView