0

i need to get video file's path for unity engine

When i use ALAsset, it return only asset url like

assets-library://asset/asset.MOV?id=B650DDD2-32EC-45B6-A38C-537F4D1BDF53&ext=MOV

so i convert to NSData and writeToFile but this solution makes memoryWarning and too slow

there is no way to get file url like

file://~~~

EX) 'noon vr' app

PS. there is no way to get video from assets-library url in Unity?

1 Answers1

1

Simply use AssetDatabase.GetAssetPath(VideoObject) to return the path of the gameobject asset in Unity Asset folder.

EDIT: If you want to access the iOS photo or video library, you have to make a plugin for that in Objective-C then wrap it around with C and then call it from C#(Unity)

There is no need to re-write the steps. You can follow steps on how to build plugins for Unity here.

How to build Unity3d Plugin for iOS

Community
  • 1
  • 1
Programmer
  • 121,791
  • 22
  • 236
  • 328
  • i need to get path of non project video file i think that is way to get path of video in project folder – SeokHui_Lee Mar 09 '16 at 18:50
  • When you mean non project file, you mean non Unity program file in iOS? What file are you trying to access and here is it saved...That may help explain things. – Programmer Mar 09 '16 at 18:54
  • Video stored in the iOS's photo library , rather than the video assets stored in the project folder – SeokHui_Lee Mar 09 '16 at 19:33
  • Ok. Your question description is actually asking different stuff than what you just said. You can change your question description to be more undertandable. To answer that, you need to make a plugin for that in Objective-C then wrap it around with C++ and then call it from C#(Unity). Updated my answer with more info – Programmer Mar 09 '16 at 19:46
  • generally writing a plugin for unity is nontrivial and there isn't always a swiss army knife tutorial - so it would have been more apropos if you linked something specifically with opening a video from the iOS photos library. @Programmer – ina Jul 27 '17 at 10:40
  • @ina I provided a link to the hardest part of doing this which is calling it from Unity. I assume that OP knows how to use Google to Google *"How to access iOS photo library"* and chose one of the many solutions out there then can use that as a plugin.... – Programmer Jul 27 '17 at 10:47
  • actually there are several complications with loading a video to unity movietexture from the iOS photo/video library – ina Jul 27 '17 at 10:56
  • No one is talking about **movietexture** in both the question, answer or comment except you. OP simply needs to get the path of the photo/video folder. That's it. Nothing else was asked and I focused on what OP asked which **can** be done if he/she follow what's in my answer. – Programmer Jul 27 '17 at 11:06