Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • LibVLCSharp LibVLCSharp
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 80
    • Issues 80
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VideoLANVideoLAN
  • LibVLCSharpLibVLCSharp
  • Issues
  • #517
Closed
Open
Issue created Nov 02, 2021 by Louis Paquin@Thelo

The Media constructor that takes a raw string path errors if given a file path with forward slashes on Windows

_mediaPlayer.Media = new Media(_libVLC, Application.dataPath + "/HitboxCrime.mp4", FromType.FromPath);

The above uses a local file path with forward slashes on Windows, both in Application.dataPath and in the suffix part. That will cause the following cryptic VLC error:

VLCException: Failed to perform instanciation on the native side. Make sure you installed the correct VideoLAN.LibVLC.[YourPlatform] package in your platform specific project
LibVLCSharp.Internal..ctor (System.Func`1[TResult] create, System.Action`1[T] release) (at /builds/videolan/vlc-unity/tmp/lvs/src/LibVLCSharp/Internal.cs:37)
LibVLCSharp.Media..ctor (System.Func`1[TResult] create, System.Action`1[T] release, System.String[] options) (at /builds/videolan/vlc-unity/tmp/lvs/src/LibVLCSharp/Media.cs:166)
LibVLCSharp.Media..ctor (LibVLCSharp.LibVLC libVLC, System.String mrl, LibVLCSharp.FromType type, System.String[] options) (at /builds/videolan/vlc-unity/tmp/lvs/src/LibVLCSharp/Media.cs:183)
MinimalPlayback.Update () (at Assets/VLCUnity/Demos/Scripts/MinimalPlayback.cs:97)

Note: This problem does not happen if you replace all forward slashes with backslashes:

_mediaPlayer.Media = new Media(_libVLC, Application.dataPath.Replace('/', '\\') + "\\HitboxCrime.mp4", FromType.FromPath);

The problem also does not happen if you use the Uri constructor for Media:

_mediaPlayer.Media = new Media(_libVLC, new Uri(Application.dataPath + "/HitboxCrime.mp4"));

Expected result: Setting a new Media with a local file path with forward slashes on Windows works without error (like most other Windows apps).

Actual result: The above error.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking

VideoLAN code repository instance