How to use (AVPro) plugin with JavaScript.

I can’t seem to figure out how to use the plugin with JS. I want to get the playbacktime of the video.

[http://downloads.renderheads.com/docs/AVProVideoClassReference-1.1.0/interface_render_heads_1_1_media_1_1_a_v_pro_video_1_1_i_media_control.html] 1 tells me to use this function: float RenderHeads.Media.AVProVideo.IMediaControl.GetCurrentTimeMs()

There are a bunch of c# examples but nothing for JS. I thought I could just import and access like other functions but that doesn’t work the way I expected.

import RenderHeads.Media.AVProVideo;

returns:

BCE0021: Namespace 'RenderHeads.Media.AVProVideo' not found, maybe you forgot to add an assembly reference?

I did find something here: Unity - Manual: Native plug-ins

@DllImport (AVProVideo)

this returns the following error:

BCE0064: No attribute with the name 'DllImport' or 'DllImportAttribute' was found (attribute names are case insensitive). Did you mean 'System.Runtime.InteropServices.DllImportAttribute'?

How should I do this?

It was a combination of issues. Part of it was my code. Part was compilation order and thus a folder issue like @meat5000 suggested.

With the package moved to “Assets/StandardAssets” and the following code it works.

#pragma strict
// Tell it which name space to use
import RenderHeads.Media.AVProVideo;
 
// We need to set the MediaPlayer that this script uses in the Unity inspector
var player :MediaPlayer;
 
function Start () {
}
 
function Update () {
    // Check the media player is initialised
    if (player != null && player.Control != null){
        // Call function to get playback details
        var time : float = player.Control.GetCurrentTimeMs();
        print("time is: " + time);
    }
}