Search Unity

[RELEASED] VLC Player for Unity (New: Youtube Streaming!)

Discussion in 'Assets and Asset Store' started by chassets, Feb 21, 2016.

  1. Cassiopeiae-73

    Cassiopeiae-73

    Joined:
    May 2, 2016
    Posts:
    6
    Hello, i would like Play a Video in a Gameobject (TV) or plane . How can i do?
     
  2. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Hi. This is currently not possible. You can play videos over the unity window, a UI Panel or the whole Screen or under all UI Elements or 3D Objects in the background.
     
  3. Cassiopeiae-73

    Cassiopeiae-73

    Joined:
    May 2, 2016
    Posts:
    6
    Thank you for answer. Come this in future? That would be very very nice.
     
  4. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    227
    I think rendering to a texture is on his Todo list (see the first post of this thread).
     
  5. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Hi! Sorry for the late reply. Yes, that is a feature I would like to have in the near future.

    BTW: Submitted the 1.03 update again yesterday, hope it's available soon! Sorry for the delay.
     
  6. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    I had an idea about using the plugin to let you record gameplay videos directly from unity and encode them into any video format you choose (that is supported by VLC). This might be not super hard to accomplish, I think I'll put this also on my list.

    What do you guys think?
     
  7. JoaquinKeller

    JoaquinKeller

    Joined:
    Apr 7, 2014
    Posts:
    5

    Hi Holzay,

    I think plenty will be interested since Unity provide native support for Gear VR and samsung plans to sell/give away millions of gearVRs this year. Watching 360 live video is the very big thing of 2016. 360 video are usually 4K btw.
     
  8. Naphier

    Naphier

    Joined:
    Aug 4, 2014
    Posts:
    114
    This looks promising. A few questions:
    • I see you have YouTube video streams working, does this also work for YouTube live streams??
    • Can I connect to a remote instance of VLC? (i.e. if I have VLC streaming on another PC can I connect to it).
    • I see you don't have texture 2d support yet, this is very important to us. How are you rendering to a UI panel without a texture 2d? This is more of a curiosity than anything.
    We have a Theta S 360 cam that we'd really like to get a live feed from. Unfortunately all live streaming services require flash and there's no Unity web browser that supports flash (rightly so). So I'm really hoping that we can use VLC as the middleman for this. Especially if we can connect to a remote instance of VLC.

    Thanks for your work!
     
  9. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Fair point, you're absolutely right.

    1) With youtube livestreams, it seems I'm just getting the first frame and the video stops. Same thing happens if I try it in a "normal" VLC media Player installed on my machine. Maybe this might work with other vlc versions, I'll investigate.

    2) I opened a "normal" VLC instance and streamed a video to rtsp://127.0.0.1:1234/stream, which I then opened in VLC for unity. Works well. (Tested in 1.03, which should be live soon)

    3) I'm basically telling the Direct3D Output where to be directly on the screen, UI is for easy positioning or moving of the video. This is the fastest video playback possible I guess, and another positive aspect is that even if you have to lower the Resolution of you game for Performance reasons, the Videos will always be rendered in best Quality in your Desktop Monitor Resolution (I really needed this for a project).


    Hope this helps and thank you guys for the interest in this plugin.
     
  10. Naphier

    Naphier

    Joined:
    Aug 4, 2014
    Posts:
    114
    Thanks, Holzay.
    I can't get Youtube live stream to work in VLC either (2.2.1). There used to be some hacks to get it to work using youtube-dl, but apparently it no longer works. If I can find out how to get it working again I'll post here.

    Hopefully we'll be able to go the route of using VLC remotely.

    Re #3, very cool and smart!
     
  11. Labkid

    Labkid

    Joined:
    Mar 4, 2016
    Posts:
    1
    Hi, I need to Stream and play a 360 youtube video. Is this possible with your plugin?
    I am really interested!
     
  12. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Thanks, very kind of you.

    I can test this tomorrow, I'm currently on the go. I'll inform you as soon as I have checked it out.

    Thanks and have a nice evening!
     
  13. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Ok, i tried it - I get the Video, but it Looks like this:


    But I have an idea how it could work, but this would be something for the next updates. But if a newer VLC Version starts supporting this, it will of course work with my plugin.
     
  14. JoaquinKeller

    JoaquinKeller

    Joined:
    Apr 7, 2014
    Posts:
    5
    These are spherical videos (aka "360 videos") in equirectangular format. The way to play these videos is to render to the inside texture2D of a sphere and to place the camera at the center of the sphere. The sphere needed to be an inverted sphere (with the texture inside) not the standard unity sphere.

    So basically what is needed is the render-to-texture feature... when do you think it will be ready ?

    (I can provide some help with the inverted sphere if needed)
     
  15. jinhaifeng

    jinhaifeng

    Joined:
    May 12, 2016
    Posts:
    6
    For some reason, I keep getting this error on this plugin (doesn't happen on any of my others:

    Unhandled Exception: System.TypeLoadException: Could not load type 'System.ComponentModel.InitializationEventAttribute' from assembly 'System.Windows.Forms'

    Anyone else getting this? I've also noticed a lot of "obselete" warnings.
     
  16. ivalduan

    ivalduan

    Joined:
    May 15, 2016
    Posts:
    1
    Regarding the license issues some others asked before, the distribution of any piece of VLC project (GPL licensed) does not obey you to redistribute the code of your entire app or plugin and any modification of the original VLC code in readable form?
    http://www.gnu.org/licenses/gpl-2.0.html#SEC3

    This is a major concern in any commercial use of GPL'ed content.
     
  17. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Hi. Sorry for the late answer, I didn't get any email that there are new answers in this thread - strange.
    Please take a few minutes to read the readme/documentation - everything is described pretty well there to get you started. At the moment you need to choose.NET 2.0 in your Player Settings, I'll make it work with 2.0 subset soon.

    Contact me if you need further assistance.
     
  18. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    With this plugin, VLC is always external and not part of your compiled app - it works if VLC is installed on the computer or if you copy a VLC Version in the Streaming assets folder - there is no modified Code, or VLC source code at use and I do not load any of its dlls.

    So you just redistribute (if you choose to put it into Streaming assets folder) a regular VLC Version anyone can download that comes with its license in the COPYING.txt and Links to its source code just like VLC says on their FAQ on complying with the license when redistributing the Player.
    (PS: *.dll files located in the StreamingAssets folder don’t participate in the compilation, so this is not an issue either.)

    But if this is still a concern, you could just tell the user to install VLC (or do it for them during installation of your software) if they don't have it installed.

    Thanks for the offer, but the render on a sphere part was already pretty clear to me ;-) I was talking about the Texture2D Video Feature - I think I can up with an intermediate solution that should work soon. Would be faster if I didn't have so much to do at work :D
     
    Last edited: May 16, 2016
  19. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Hi Phillipe, I got your email - I replied you there :)
     
  20. jinhaifeng

    jinhaifeng

    Joined:
    May 12, 2016
    Posts:
    6
    I got it figured out. thanks!
     
  21. jinhaifeng

    jinhaifeng

    Joined:
    May 12, 2016
    Posts:
    6
    Anyone have luck getting this to work in VR? I assume it's possible setting it up as a panel over-lay, but am struggling to get it to display on my oculus. The video plays in my panel on my monitor, but doesn't show on the oculus which is weird.

    Any tips/tricks would be greatly appreciated
     
    Last edited: May 18, 2016
  22. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Hi! As it says in this thread and in the description on the asset store page, the video gets rendered directly to screen for Speed/performance reasons - this is why it works only Fullscreen, over the unity window, over a 2D UI Panel. For VR, it needs to be rendered into a Texture2D.

    I'm currently in the process of making this work as a free add-on to the plugin, here's a little teaser screenshot of a YT Video rendered onto a plane. Guess this will be ready in the next 1 or 2 weeks.



    This is still very much in beta though and needs additional open source library, and probably it'll be replaced by something better in the future - but it works, plays videos smoothly and you should be able to use all VLC features like Youtube-Streaming and 360° YT Videos etc.
     
  23. Shardik

    Shardik

    Joined:
    Feb 18, 2013
    Posts:
    11
    hi! i have little and useful questions - can i use external subtitles (srt) for this asset? Can it work success?

    For example: using SRT Subtitle Reader can play with your asset?
     
    Last edited: May 23, 2016
  24. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Hi! This should be possible - and you shouldn't need the other plugin in your link for this, I'll check it today and get back to you!
     
  25. Shardik

    Shardik

    Joined:
    Feb 18, 2013
    Posts:
    11
    Thanks for the quick response! I will wait for the results )
     
  26. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    I made a quick test and it works. At the moment you have to add a string to your Video filename, like this:


    I'll make this more convienient for the user in the future.
     
  27. Shardik

    Shardik

    Joined:
    Feb 18, 2013
    Posts:
    11
    Looks good!
    except local subtitle files, you can use external sources? )) It's work also with youtube ?))
     
  28. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Hmm, I don't think VLC can get the subtitles from YouTube streams. You can however open a srt file while playing a YouTube Video, so this would do the trick.
    Subtitles should work from any Location accessible I think, however I'm not at home and currently unable to check this, sorry.
     
  29. thylaxene

    thylaxene

    Joined:
    Oct 10, 2005
    Posts:
    716
    Looks very promising!

    +1 for OSX support ASAP. As soon as that is supported I will buy it at whatever price you set!

    Cheers.
     
  30. Shardik

    Shardik

    Joined:
    Feb 18, 2013
    Posts:
    11
    Yes! I mean - subtitles must shown from own server via http, not on youtube channel because subtitles not free and paid by sponsors.
     
  31. Shardik

    Shardik

    Joined:
    Feb 18, 2013
    Posts:
    11

    cant read srt file with youtube source? help please)
     
  32. gman42

    gman42

    Joined:
    May 3, 2014
    Posts:
    3
    if you play 3d content how does it handle it? for the vr example, at least for the rift, there are ways to render individually to each eye so if you had sbs or t/b and were able to split the views it would like 3d in hmd. Is there a way to trigger sbs or tb with addons to the file name or is this something you might consider for an update?
     
  33. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    The Problem isn't youtube, but the loading of the sub file. It seems that VLC can't load subtiles over http, I also can't do it in my installed "regular" VLC.

    You could try something like this: use Unitys WWW classes to download the subtitle and save it locally.
     
  34. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    As soon as Streaming to Texture2D works (actually, it does already, and will come as a free addon soon, but I have a lot of stuff going on right now) I'm able to render a Side by Side Video or Top / Bottom for each eye easily, since it is only a matter of the UVs of the mapped sphere for each eye - So the left side of the RenderTexture will be visible on the left sphere for the left eye, and the same for the other eye.

    I want to bring this for sure, also there were already requests for Youtube 360° Videos, which are all T/B afaik.

    Hope this helps.

    EDIT: As for your question on how to trigger it, I'd prefer a simple checkbox in the script settings, but a expression in the filename would of course also be possible.
     
  35. Shardik

    Shardik

    Joined:
    Feb 18, 2013
    Posts:
    11
    Well, how i can load subtitles locally with youtube video? any steps and command line examples? Thanks)
     
  36. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Just like with any other Video: (VLC just can't load Subs from http, but that has nothing to do with playing from YouTube ;-) )

    So, just put something like this in the path field:


    I'll put subtitles on my TODO list, since this isn't super user friendly. Hope this helps!
     
  37. ming_dynasty

    ming_dynasty

    Joined:
    May 26, 2016
    Posts:
    1

    holzay, I was wondering if you got your plugin to record gameplay yet?
     
  38. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Hi!
    It is still on my list, but I haven't started on it yet. I guess after the render to texture feature, I'll want to bring playlist support and I'll try implementing the recording feature.
     
  39. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Just submitted the 1.04 Update, should be live in a couple of days.

    New Features:
    • Better Audio Control
    • Better SRT Subtitle Support
    • Possibility to stream to Texture2D, see the readme for Details. This is still in BETA, no warranties ! This is a seperate, free download and not officially part of the plugin.
     
    Last edited: Jun 17, 2016
    zyzyx likes this.
  40. construktiv

    construktiv

    Joined:
    May 27, 2016
    Posts:
    2
    This looks promising! Do you have a demo Version of the plugin? I'd like to test some things before buying.
     
  41. construktiv

    construktiv

    Joined:
    May 27, 2016
    Posts:
    2
    I just realized there is a demo Link. Sorry.
     
  42. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Sorry for the late reply, I'm currently abroad and don't have Internet all the time. Glad you found the link, if you need a more specific Demonstration I could send you something next week on Wednesday, when I return.

    If you have any questions specifically, ask per Mail or here, I'll check as often as I can.

    Thanks!
     
  43. BB_Nabu

    BB_Nabu

    Joined:
    Apr 5, 2016
    Posts:
    4
    Hi there,
    I have to say... it really looks great!!I

    I am wondering if it would be outrageous to expect that this plugin of yours could potentially work with XBOX (Unity built for XBox, not UWP running in Xbox).

    Thanx
     
  44. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    I'm pretty sure this won't work for Xbox, sorry.
     
  45. vicciu5

    vicciu5

    Joined:
    Sep 4, 2013
    Posts:
    11
    The rendering to texture works great, but now another question came up. When playing Youtube 360 Videos, the quality of the video is low, even if it looks great in the browser as long as I select the 4K option. Is there a way to set the preferred video quality for the plugin?
     
  46. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    Hmm, this is something that gets handled by VLC internally. But for normal Videos, I always seem to get the best quality - I'll look into it. Thanks!
     
  47. vicciu5

    vicciu5

    Joined:
    Sep 4, 2013
    Posts:
    11
    Well, the video quality is 1080p probably, the same as the display resolution, however when displaying a 360 degree video, only about 1/4 of the video is visible at a time(half the width and half the height). Because of this, in order for the 360 degree video to look good on a 1080p display, the video resolution needs to be 4K.

    Also one more bug I noticed is that the volume isn't changing in the "Play to Texture" mode.
     
    Last edited: Jun 16, 2016
  48. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    yes, strange indeed. VLC seems to take the commands, but it doesnt affect the stream. Could be that this is a bug in the used VLC Version. The stream to texture mode is still very much in beta, not all features / formats will work without troubles.
     
  49. SystemDevel

    SystemDevel

    Joined:
    Oct 5, 2013
    Posts:
    36
    Hi @holzay

    I need urgent an answer….

    I’m thinking on buying your asset VLC Player for Unity but I need to know if I can put a video on a UI element, and if other UI element like an Image it’s over this UI element the video it’s hidden or ALWAYS it’s on top? I need to know if I can do like this image


    I’ts urgent because I have to do it today!!!!

    Thanks You.
     
  50. chassets

    chassets

    Joined:
    Nov 27, 2013
    Posts:
    310
    I got your mail and replied you there :)