iBicha / UnityYoutubePlayer

Play YouTube videos in Unity
The Unlicense
336 stars 63 forks source link

Can't start process on IL2CPP #79

Closed VNA-DJ closed 1 year ago

VNA-DJ commented 2 years ago

youtube player is does not working. giving me this error

Win32Exception: ApplicationName='/var/folders/df/xbvq1ggn2ts0v0g3_bgn8gd40000gn/T/.../.../youtube-dl.exe', CommandLine='--dump-single-json -f "best" "https://www.youtube.com/watch?v=RcHJTZTrZGI​"', CurrentDirectory='', Native error= mono-io-layer-error (5) System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) (at :0) System.Diagnostics.Process.Start () (at :0) (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start() YoutubePlayer.LocalYoutubeDl.ReadProcessOutputAsync (System.String filename, System.String arguments, System.Threading.CancellationToken cancellationToken) (at Packages/com.ibicha.youtube-player/Runtime/YoutubeDl/LocalYoutubeDl.cs:104) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0) YoutubePlayer.LocalYoutubeDl+<GetVideoMetaDataAsync>d__11[T].MoveNext () (at Packages/com.ibicha.youtube-player/Runtime/YoutubeDl/LocalYoutubeDl.cs:34) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0) YoutubePlayer.YoutubeDl+<GetVideoMetaDataAsync>d__131[T].MoveNext () (at Packages/com.ibicha.youtube-player/Runtime/YoutubeDl/YoutubeDl.cs:51) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0) YoutubePlayer.YoutubePlayer+<GetRawVideoUrlAsync>d__14.MoveNext () (at Packages/com.ibicha.youtube-player/Runtime/YoutubePlayer.cs:64) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0) YoutubePlayer.YoutubePlayer+d15.MoveNext () (at Packages/com.ibicha.youtube-player/Runtime/YoutubePlayer.cs:80) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.TaskAwaiter.GetResult () (at <695d1cc93cca45069c528c15c9fdd749>:0) YoutubePlayer.PrepareYoutubeVideo+d2.MoveNext () (at Assets/YoutubePlayer/Scripts/PrepareYoutubeVideo.cs:17) --- End of stack trace from previous location where exception was thrown --- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) (at <695d1cc93cca45069c528c15c9fdd749>:0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153) UnityEngine.UnitySynchronizationContext:ExecuteTasks() (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)

iBicha commented 2 years ago

Can you provide some details (platform, unity version, etc)

VNA-DJ commented 2 years ago

PC/Mac and 2021.20.1

iBicha commented 2 years ago

Are you running in IL2CPP on desktop?

Gama-Tech commented 1 year ago

I'm also having this issue.

YouTube playback works in the Editor, but not in the Build. I'm using Unity 2021.3.3f1, and the build is targeting Windows and is compiling using IL2CPP.

iBicha commented 1 year ago

Unfortunately, it seems like an IL2CPP build cannot start a process. https://forum.unity.com/threads/win32-il2cpp-process-start-not-work.539258/ The options are to use a Mono backend, or to set YoutubeDl.UseLocalInstance to false on IL2CPP.

I will make YoutubeDl.UseLocalInstance be set to false by default on IL2CPP in a future release.

Gama-Tech commented 1 year ago

Thanks for the follow up, setting YoutubeDl.UseLocalInstance to false is a viable work around for me!