thanh-nguyen-kim/Unity_Android_Screen_Recorder

Getting "path" null from ScreenRecorderService class.

Closed this issue · 5 comments

I had integrated this plugin a year ago, and now I'm upgrading it to support Android 10 and above. With previous version, I was able to give my own path and filename. With this new version I wasn't able to give my own path or filename, which I'm okay with for now, but I'm trying to get the full path of the generated video (saved in gallery) from recording. I want the full path preferably when it's set. I'm using ScreenRecordService.getFilePath() in my main activity and passing the string to Unity using UnityPlayer.UnitySendMessage(). The returned string when logged in unity, prints as null/HD2020-11-27-18-23-34.mp4. I want full path of the video file so I can save it with my prefs, because I already have a native share up and running. And for that, I need the full path of the file for that to work.

Hi.
I think you should try "hbRecorder.getFilePath()" after recording process is completed to get the full path.
I will have a further look at the demo if it doesn't work.
Sincerely
Tee

Hello, @Dakshesh10 Did you find a solution? I am having the same problem.
@thanh-nguyen-kim Did you mean "hbRecorder.getFilePath()" in the "AndroidUtils.java" ?

Thanks

Hi
There is an easy way to get the file which is recorder. Look at this line of code

androidRecorder.Call("setUpSaveFolder","Tee");//custom your save folder to Movies/Tee, by default it will use Movies/AndroidUtils

Recorded video always save in this folder.
After the recording is completed, it is the newest file from this folder.

You can get the file path directly from the record plugin by modify HBRecorderOnComplete() in AndroidUtils.java

UnityPlayer.UnitySendMessage(this.mGameObject, "VideoRecorderCallback", hbRecorder.getFilePath());

Have a good day
Tee

@thanh-nguyen-kim
Hello.
We use this plugin to record a video and then create a function that we want to share on social media.

  1. Recording was successful
  2. I also found an asset to share on social media
  3. However, I don't know how to get the path of the recorded file as a string value from Unity.

Can you help?
I just need to get the path value as a string, but I have no idea. I would be really grateful if you could help.

Hi
There is an easy way to get the file which is recorder. Look at this line of code

androidRecorder.Call("setUpSaveFolder","Tee");//custom your save folder to Movies/Tee, by default it will use Movies/AndroidUtils

Recorded video always save in this folder.
After the recording is completed, it is the newest file from this folder.

You can get the file path directly from the record plugin by modify HBRecorderOnComplete() in AndroidUtils.java

UnityPlayer.UnitySendMessage(this.mGameObject, "VideoRecorderCallback", hbRecorder.getFilePath());

Have a good day
Tee