Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Wenneker · Apr 07, 2016 at 05:40 PM · javascriptdllplugins

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 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: http://docs.unity3d.com/Manual/NativePlugins.html

 @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?

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image meat5000 ♦ · Apr 07, 2016 at 04:27 PM 0
Share

$$anonymous$$ake sure the Plugin is put in the right place in the editor.

avatar image Wenneker meat5000 ♦ · Apr 08, 2016 at 03:27 PM 0
Share

I'm pretty sure the plugin is in the right place. It's in Assets/Plugins and C# works fine. However I think I'm slowly working towards a solution. I missed the InteropServices.

 #pragma strict
 
 import System;
 import System.Runtime.InteropServices;
 @DllImport ("AVProVideo")
 
 static private function GetDuration$$anonymous$$s() : float {};

This no longer gives an error. Until I call "getDuration$$anonymous$$s()" that is. The new error is: EntryPointNotFoundException: GetDuration$$anonymous$$s

avatar image meat5000 ♦ Wenneker · Apr 08, 2016 at 03:55 PM 0
Share

Yeah that was given to you in the error :P

Anyway, just in case it is a Plugin Placement issue, take a gander at this

http://docs.unity3d.com/$$anonymous$$anual/PluginInspector.html

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Wenneker · Apr 12, 2016 at 04:34 PM

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);
     }
 }
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Craig-Overman · Dec 16, 2016 at 03:55 PM 0
Share

I'm trying to do the same thing, and having a very frustrating time with it.

In hopes of just getting it to work, I've copied your above code entirely, and tried moving the plugin around in the folder structure everywhere I can think of. ...nothing...I still get the "Namespace not found" error.

Is there any way that I can trouble you for a more detailed description of what you've done?

I'm running Windows 7 and Unity 4.7.2, if that helps. Thanks!

avatar image Wenneker Craig-Overman · Dec 19, 2016 at 08:58 AM 0
Share

I can't really remember exactly. It's been a while. ;)

If you haven't figured it out over the past 2 days I can send you the project I used to test it. Unfortunately it's over the filesize limit for this forum so you'll need to P$$anonymous$$ me a mailaddress and I'll send it with WeTransfer.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I import and use a plugin/API? 0 Answers

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Windows 8 - DLLNotFoundException. Windows 7 - No problems! 0 Answers

Importing a DLL that contains C#-wrapped C++ Code 0 Answers

Error with Plugin on Windows Phone 8 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges