ESRealView

Inherits fromESScriptingPluginView:ESNetscapePluginView:NSView:NSObject
FrameworkFlashInApp.framework
Declared in ESRealView.h
Companion guideFlash’In’App Programming Guide 
Required system version Mac OS X 10.4 and higher

 

Class description


ESRealView class is defined to interact with RealPlayer plugin. ESRealView is based on ESScriptingPluginView and adds all required functions for correct work with RealMedia.

 

Class constants


The following constants of RealPlayState type are used to playback state constants:

PLAYSTATE_STOPPED

Stopped

PLAYSTATE_CONTACTING

Contacting

PLAYSTATE_BUFFERINGBuffering
PLAYSTATE_PLAYINGPlaying
PLAYSTATE_PAUSEDPaused
PLAYSTATE_SEEKINGSeeking

 

The following constants are used to callback type constants:

Real_NoCallbacks

do not get callbacks

Real_OnPosLength

get messages when the position in the clip changes (realView:changePosition:withLength: will be called)

Real_OnErrorMessage get error messages (called by realView:receiveError:withLevel:rmaCode:userCode:userString:moreInfo:)
Real_OnErrorMessage get error messages (called by realView:receiveError:withLevel:rmaCode:userCode:userString:moreInfo:)

 

Note: These constants may be combined via OR.

 

The following constants are used for error level (used in realView:receiveError:withLevel:rmaCode:userCode:userString:moreInfo:):

Real_PanicError

Error potentially causing a system failure. RealSystem takes actions necessary to correct the problem. This may include shutting down the presentation.

Real_SevereError

Error requiring immediate user intervention to prevent a problem. RealSystem will shut down the presentation if necessary.

Real_CriticalErrorError that may require user intervention to correct. RealSystem will shut down the presentation if necessary.
Real_GeneralErrorError that does not cause a significant problem with normal system operation.
Real_WarningError Warning about a condition that does not cause system problems but may require attention.
Real_NoticeErrorNotice about a condition that does not cause system problems but should be noted.
Real_InformationalErrorInformational message only.
Real_DebugErrorInformation of use only when debugging a program.

 

 

Tasks


Callbacks Application Gets from RealPlayer   

Controlling Playback

Obtaining Play State Information

Seeking Through a Clip

Accessing Clip Title, Author, and Copyright Information

Error Handling    

Setting the Display Size

Controlling Audio

Receiving Messages from RealPlayer

 

Instance methods


callbackFlags

This method sets which callbacks application gets from RealPlayer.

– (unsigned int) callbackFlags;

Return value

The callbacks application gets from RealPlayer.

 

setCallbackFlags:

This method sets which callbacks application gets from RealPlayer.

– (void) setCallbackFlags:(unsigned int)aFlags;

 

canPlay

This method indicates whether the player is currently paused or stopped, or is currently playing.

– (BOOL) canPlay;

Return value

Returns YES if the player is currently paused or stopped, and current source file is valid. Returns NO if the player is currently playing.

 

doPlay

This method plays the current clip. Equivalent to clicking the Play button.
– (BOOL) doPlay;

Return value
Returns YES if the operation was successful, otherwise NO.

 

canPause

This method indicates whether the player is currently playing a clip that can be paused.
– (BOOL) canPause;

Return value
Returns YES if the player is currently playing a clip. Returns NO if the player is already paused or stopped.

 

doPause

This method pauses the current clip. Equivalent to clicking the Pause button.
– (BOOL) doPause;

Return value
Returns YES if the operation was successful, otherwise NO.

 

canStop

This method indicates whether the current clip is playing or paused, or the clip is already stopped. This method is compatible with RealPlayer version 5.0 and later.
– (BOOL) canStop;

Return value
Returns YES if RealPlayer is currently playing a clip or is paused. Returns NO if the clip is already stopped.

 

doStop

This method stops the clip. Equivalent to clicking the Stop button. This method is compatible with RealPlayer version 5.0 and later.
– (BOOL) doStop;’

Return value
Returns YES if the operation was successful, otherwise NO.

 

bufferingTimeElapsed

This method indicates the current elapsed buffering time.
– (int) bufferingTimeElapsed;

Return value
Returns the elapsed buffering time in milliseconds.

 

bufferingTimeRemaining

This method indicates the estimated remaining buffering time.
– (int) bufferingTimeRemaining;

Return value
Returns the estimated remaining buffering time in milliseconds.

 

lastMessage

This method gets the text of the last status message
– (NSString *) lastMessage;

Return value
Returns the last status message.

 

playState

This method indicates the current state of the RealPlayer.
– (RealPlayState) playState;

Return value
Returns current play state.

 

length

This method indicates the total length of the clip.
– (int) length;

Return value

Returns the total length of the clip, in milliseconds. Valid values are >=0.

 

position

This method indicates the current position in the clip.
– (int) position;

Return value
Returns the current position in the clip, in milliseconds. Valid values are >=0 and <=total clip length.

 

setPosition:

This method seeks into the clip to the specified point.
– (BOOL) setPosition:(int)aPos;

Parameters
aPos – The point in the clip to which to seek, in milliseconds. Valid values are >=0 through <=total clip length. If an attempt is made to set the position >total length, then SetPosition will equal total length.

Return value

Returns YES if the operation was successful, otherwise NO.

 

title

This method indicates the current clip’s title string.
– (NSString *) title;

Return value
Returns the current clip’s title.

 

setTitle:

This method sets the current clip’s title string, overriding any existing title information.
– (BOOL) setTitle:(NSString *)aTitle;

Parameters
aTitle – The title string to be set. This title string overrides all subsequent title information in a multiclip presentation.

Return value
Returns YES if the operation was successful, otherwise NO.

 

author

This method indicates the current clip’s author string.
– (NSString *) author;

Return value
Returns the current clip’s author.

 

setAuthor:

This method sets the current clip’s author string, overriding any existing author information.
– (BOOL) setAuthor:(NSString *)anAuthor;

Parameters
anAuthor – The author string to be set.

Return value
Returns YES if the operation was successful, otherwise NO.

 

copyright

This method indicates the current clip’s copyright string.
– (NSString *) copyright;

Return value
Returns the current clip’s copyright information.

 

setCopyright:

This method sets the current clip’s copyright string, overriding any existing copyright information.
– (BOOL) setCopyright:(NSString *)aCopyright;

Parameters
aCopyright – The copyright string to be set.

Return value
Returns YES if the operation was successful, otherwise NO.

 

clipHeight

This method indicates the height of the presentation.
– (int) clipHeight;

Return value
Returns the height of the clip window, in pixels. A value of 0 is returned when the presentation is not visual.

 

clipWidth

This method indicates the width of the presentation.
– (int) clipWidth;

Return value
Returns an int32 that contains the width of the clip window, in pixels. A value of 0 is returned when the presentation is not visual.

 

wantErrors

This method indicates whether error dialogs will be displayed.
– (BOOL) wantErrors;

Return value
Returns YES if error dialogs are trapped, and therefore not displayed. Returns NO if the error dialogs are displayed.

Discussion

If you set this flag to NO, but still want to be informed about errors, call setCallbackFlags method with Real_OnErrorMessage parameter
and implement realView:receiveError:withLevel:rmaCode:userCode:userString:moreInfo: method in your delegate.

 

setWantErrors:

This method indicates whether error message will be shown on the screen or will be just sent to the delegate.

– (BOOL) setWantErrors:(BOOL)aFlag;

Parameters
aFlag – If set to YES, the errors are trapped and no error dialogs occur in the player. If set to NO, error dialogs are displayed in the player.
Return value
Returns YES if the operation was successful, otherwise NO.

NOTE: if you set this flag to NO, but still want to be informed about errors, call setCallbackFlags method with Real_OnErrorMessage parameter and implement realView:receiveError:withLevel:rmaCode:userCode:userString:moreInfo: method in your delegate.

 

lastErrorSeverity

This method indicates the error level for the last error.
– (RealErrorLevel) lastErrorSeverity;

Return value
Returns the error level. See RealErrorLevel for possible values.

 

lastErrorUserCode

This method indicates the user error code from the last error.
– (int) lastErrorUserCode;

Return value
Returns the user error code.

 

lastErrorUserString

This method gets the error string from the last error dialog.
– (NSString *) lastErrorUserString;

Return value
Returns the last error message.

 

lastErrorRMACode

This method gets the RMA error code from the last error.
– (int) lastErrorRMACode;

Return value
Returns the error code value.

 

lastErrorMoreInfoURL

This method provides the “more info” URL from the last error.
– (NSURL *) lastErrorMoreInfoURL;

Return value
Returns the “more info” URL. This method may return nothing (for example, if there is no “more info” URL).

 

isOriginalSize

This method indicates whether the image is currently in its original size.
– (BOOL) isOriginalSize;

Return value
Returns YES if the image is in its original size. Returns NO if the image is not in its original size.

 

makeOriginalSize

This method sets the image window to its original size.
– (BOOL) makeOriginalSize;

Return value
Returns YES if the operation was successful, otherwise NO.

 

isMuted

This method indicates whether or not the volume has been muted.
– (BOOL) isMuted;

Return value
Returns YES if the volume is muted. Returns NO if the volume is not muted.

 

setMuted:

This method sets the mute state.
– (BOOL) setMuted:(BOOL)aFlag;

Parameters
aFlag – If set to YES, the audio is muted. If set to NO, the sound is not muted.

Return value
Returns YES if the operation was successful, otherwise NO.

 

volumeLevel

This method indicates the current volume level.
– (int) volumeLevel;

Return value
Returns the current volume level. The returned value will be in the range from 0 to 100.

 

setVolumeLevel:

This method sets the volume level.
– (void) setVolumeLevel:(int)aLevel;

Parameters
aLevel – The volume level to be set. Valid values are 0 through 100.

 

isStereo

This method indicates whether the current clip is in stereo.
– (BOOL) isStereo;

Return value
Returns YES if the current clip is in stereo and FALSE for mono.

 

Delegate methods


realView:changePosition:withLength:

This method is called when the position in the clip changes.

– (void) realView:(ESRealView *)aRealView changePosition:(int)aPosition withLength:(int)aLength;

Parameters
aRealView – the real view that sent the message
aPosition – the current position of the clip, in milliseconds.
aLength – the length of the clip, in milliseconds.

Discussion
This method is called only if you set callbackFlags to Real_OnPosLength.
 

realView:receiveError:withLevel:rmaCode:userCode:userString:moreInfo:

This method is called when an error occurs.

– (void) realView:(ESRealView *)aRealView receiveError:(NSString *)anError withLevel:(RealErrorLevel)aLevel rmaCode:(int)aRmaCode userCode:(int)aUserCode userString:(NSString *)anUserSrting moreInfo:(NSURL *)anInfoURL;Parameters
aRealView – the real view that sent the message
anError – a text description of the error.
aLevel – the error level for the last error.
aRmaCode – the RMA error code from the last error.
aUserCode – the user error code from the last error.
anUserSrting – the error string from the last error dialog.
anInfoURL – the “more info” URL from the last error. This may be empty (for example, if there is no “more info” URL).

Discussion
This method is called only if you set callbackFlags to Real_OnErrorMessage.

 

realView:didCallFunction:withArguments:

This method is called when the message from RealPlayer is received.

– (void) realView:(ESRealView *)aRealView didCallFunction:(NSString *)aName withArguments:(NSArray *)anArguments;

Parameters
aRealView – the Real view that sent the message
aName – the name of the function that was called
anArguments – the arguments, the function was called with

Discussion

If realView:changePosition:withLength: method was not implemented, but callbackFlags value is equal to Real_OnPosLength, you receive notification about invoking the function with “OnPosLength” name with 2 arguments.