Description

V2 scripts are built on top of the ScriptProvider class that is practically the same for plugins. All of the classes available to Plugins are also available to V2 scripts. Please consult the Plugin Documentation for more information about the ScriptProvider and the new classes.

A provider object is created for you called "provider" and it can have methods overridden like the following:

--[[Director
function provider:MethodName(Args)
	--method body
end;
EndDirector]]--
						

Methods and Properties

  Name Description
Public method nil Log(string message) Logs a message to the plugin log.
Public method Quality Quality Returns the current quality setting the user specified in PlayOn Settings.
Public method VirtualFileSystem VFS Returns the VirtualFileSystem instance for this provider.

Overridable Methods

  Name Description
Public method nil LoadDynamicVirtualFolder(VirtualFolder vf); Called when a Dynamic Virtual Folder needs loading, such as the root folder.
Public method PlaybackDescriptor CreatePlaybackDescriptor(Virtual[Audio|Video|Image]File vavif); Returns a new instance of a PlaybackDescriptor for the given Virtual file type.

Automatically Imported Classes (Consult Plugin Documentation or .NET Framework)

  Name Description
Public method NameValueCollection Stores key/value pairs of strings.
Public method DateTime Represents dates and times.
Public method InternetRequest Makes requests to web sites for getting or posting data.
Public method SimpleTask Represents simple background tasks.
Public method SimpleTaskManager Manages background tasks.
Public method Text Provides helper routines to convert HTML to XML and time formats.
Public method Quality The quality level (performance setting) as set in PlayOn Settings.
Public method MediaFormat The different types of media that PlayOn can handle.
Public method AdItem An advertisement that can be attached to a PlaybackItem.
Public method PlaybackItem A piece of media that can be played back with possible advertisements to be attached to a PlaybackDescriptor.
Public method PlaybackDescriptor Describes the media to playback and how.

Example


function provider:LoadDynamicVirtualFolder(vf)
	if vf == self.VFS.Root then
		vf.Dynamic = false;
		local url0 = "http://www.youtube.com/watch?v=c4xmZLv_wI8&feature=player_detailpage";
		local url1 = "http://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=player_detailpage";
		local url2 = "http://www.youtube.com/watch?v=CD2LRROpph0&feature=player_detailpage";
		self.VFS:CreateVideoFile(vf, "Test Video 0", url0, "Test Video 0", "http://www.playon.tv/sites/all/themes/playonblue/assets/PlayOnBox75.png", DateTime.Now, url0, nil, 0, 0, nil, nil);
		self.VFS:CreateVideoFile(vf, "Test Video 1", url1, "Test Video 1", "http://www.playon.tv/sites/all/themes/playonblue/assets/PlayOnBox75.png", DateTime.Now, url1, nil, 0, 0, nil, nil);
		self.VFS:CreateVideoFile(vf, "Test Video 2", url2, "Test Video 2", "http://www.playon.tv/sites/all/themes/playonblue/assets/PlayOnBox75.png", DateTime.Now, url2, nil, 0, 0, nil, nil);
	end;
end;

function provider:CreatePlaybackDescriptor(vvf)
	local pd = PlaybackDescriptor(vvf.Path, MediaFormat.FlashDirect);
	pd.AudioAbortInterval = 15;
	pd.VideoAbortInterval = 15;
	return pd;
end;
			  

See Also