Is there any way to zoom in a video with VLCJ like VLC has this feature. I think it is called magnify or interactive zoom.
It is under Tools >> Effects and filters >> Video >> Geometry >> Magnify
I use vlcj with javafx 9, rendering frames to a canvas with an EmbeddedMediaPlayer.
I also try to add this magnify filter to MediaPlayerFactory like new MediaPlayerFactory("--video-filter=magnify") but i have no idea, how to navigate this feature or set zoom level since "-zoom 2.0" is not working.
I tried cropping, but that havent worked for me, or i tried really badly.
Thank you for your help!
As a bare minimum this should work for zooming:
mediaPlayer.video().setScale(float factor);
Where factor is like 2.0 for double, 0.5 for half and so on.
In my experience, it can be a bit glitchy, and you probably do need to use it in conjunction with crop - and by the way, cropping does work.
But if you want an interactive zoom, then you build that yourself invoking setCrop and setScale depending on some UI interactions you control.
For the picture-in-picture type of zoom, if you're using VLC itself you do something like this:
vlc --video-filter=magnify --avcodec-hw=none your-filename.mp4
It shows a small overlay where you can drag a rectangle and change the zoom setting.
In theory, that would have been possible to use in your vlcj application by passing arguments to the MediaPlayerFactory:
List<String> vlcArgs = new ArrayList<String>();
vlcArgs.add("--avcodec-hw=none");
vlcArgs.add("--video-filter=magnify");
MediaPlayerFactory factory = new MediaPlayerFactory(args);
The problem is that it seems like you need "--avcodec-hw=none" (to disable hardware decoding) for the magnify filter to work - BUT that option is not supported (and does not work) in a LibVLC application.
So unfortunately you can't get that native "magnify" working with a vlcj application.
A final point - you can actually enable the magnify filter if you use LibVLC's callback rendering API (in vlcj this is the CallbackMediaPlayer) as this does not use hardware decoding. However, what you would see is the video with the magnify overlays painted on top but they are not interactive and your clicks will have no effect.
So in short, there's no satisfactory solution for this really.
In theory you could build something yourself, but I suspect it would not be easy.
Related
I'm trying to enhance the gTile extension by allowing it to resize a fullscreen window to a tiled area of the screen. That's a pretty common thing to do when tiling and it's pretty handy since some windows will hide some chrome when in fullscreen mode. But I'm having the hardest time figuring out how to do that.
Searching the internet led me to this forum post which mentions EWMH and _NET_WM_FULLSCREEN. I've tried to find ways to access window manager hints but can't find anything bashing by head on Looking Glass or scanning through the docs. Is this kind of thing possible through a shell extension?
Meta.Window is likely what you are looking for:
https://gjs-docs.gnome.org/meta4~4_api/
Setting Window.decorated = false may be able to remove the title bar or perhaps getting the compositor object and changing it from there. However this will still keep the address and tab bars in chrome. You may need to find another method to signal chrome to hide those.
There is not really an easy way to do this, the thread you linked is in regards to VLC and modifying it's source code.
I have a vague memory of a Unity video tutorial where the guy hid some objets while building a scene. The thing is that he dind't use the usual 'disable/enable the object via the inspector checkbox' and so he didn't have to worry to enable them later... moreover, as the objects were 'invisible but enabled', all attached behaviours were working.
As far as I remember the effect was pretty similar to moving the object into a hidden layer (but not changing the object layer but using a different Unity built-in action so he actually dind't change anything in the object).
I've been trying to remember how he did such a thing and looking around the editor to find the specific option but with no luck. Honestly, I'm beginnig to think that I might not be remembering correctly. Do anyone know about this 'hide objects without changing them' command?
Regards!
Sounds like he might have just turned the object's renderer off. Each GaneObject is going to have some kind of renderer as a property in the inspector (sprite renderer if its 2D, ect). He probably just disabled that as opposed to disabling the entire GameObject. Let me know if that helps!
I've just received by chance a link to a video on twitter (I think it's the very same I was trying to remember but I'm not 100% sure). Anyway it seems that my current Unity version 2018.3.3) doesn't include that 'Scene visibility' toggle; it seems to be available for 2019 Beta. . I didn't test it yet but it seems pretty straightforward, just click on a gray bar in the hierarchy bar, to the left of the object you want to 'hide'; the bar seems to work as a an visible/not visible toggle. Here a link to de video where you can see the thing working!
I hope it helps!!
The thing is I tried using https://baskren.github.io/Forms9Patch/ but I feel like I don't fully grasp it.
Don't get me wrong, the tool is great it does stretch the 9patch images. It's just that I can't get the buttons to look properly based of Google brand guidelines.
https://developers.google.com/identity/branding-guidelines
The way it should look
And this here are the drawables I am using :
https://developers.google.com/identity/images/signin-assets.zip.
Here are the results of different button tries and dimensions
This is the code that got me the closest to the button I want
<f9p:Button Text = "Sign in with xxhdpi"
TextColor="White"
FontSize="14"
FontFamily="sans-serif-medium"
WidthRequest="60"
>
<f9p:Button.BackgroundImage>
<f9p:Image Source="{local:ImageMultiResource TestingApp.Resources.Images.btn_google_signin_dark_normal_xxhdpi}"/>
</f9p:Button.BackgroundImage>
</f9p:Button>
I tried using a grid with image and button as well but it didn't work out.
It would be awesome if someone would point me in a proper direction.
I've actually done this before. Here is a general outline of what I did:
Put your multi-platform icon files into your .NetStandard project as Embedded Resources. This means that I found all of the various resolutions provided by Google (_xxhdpi, _xhdpi, _hdpi, _mdpi, etc) and then renamed them to the following:
icon#¾x.png
icon.png
icon#1½x.png
icon#2x.png
icon#3x.png
icon#4x.png
And then put them in to the Resources/Google folder in my project (FormsFirebase.Ui). So, for example, the EmbeddedResourceId for the first file, in the above list, is FormsFirebase.Ui.Resources.Google.icon#¾x.png.
As you will see in a moment, renaming these files, as shown above, will allow Forms9Patch.Button to pick the right image for the right screen resolution (so it will look great) - freeing you from having to manage this. Likewise, putting them in the .NetStandard project means they are available for all platforms - freeing you up from having to figure this out multiple times!
In your Forms9Patch.Button, refer to the above icon image in a resolution independent fashion. This can be done a couple of ways. One of the more verbose ways is:
var myButton = new Forms9Patch.Button
{
Text = "Sign in with xxhdpi",
TextColor=Color.White,
FontSize=14,
FontFamily="sans-serif",
WidthRequest=60,
IconImage = new Forms9Patch.Image
{
Source = Forms9Patch.ImageSource.FromMultiResource("FormsFirebase.Ui.Resources.Google.icon", GetType().Assembly),
Padding = 1,
},
Spacing = 4,
TintIcon = false,
BackgroundColor = Color.FromRGB(81,134,236)
};
A couple of things to Note:
First, I set TintIcon to false in order to not tint the icon to the same color as the TextColor. Also, I set IconImage, not BackgroundImage. This is to be sure the image is a peer to the text, rather than in a layer below it.
Also note that I am able to set the padding of the IconImage as well as the Forms9Patch.Button.Padding and the Forms9Patch.Button.Spacing (the distance between the IconImage and the Text or HtmlText, depending on if HasTightSpacing has been set to true).
Instead of using multiple .png files (for each screen resolution), if you have .svg version of your image available, you can use that instead. Much less work!
Another thing you might be interested in: Just as Forms9Patch handles images in a platform independent fashion (by putting them in a cross platform project as Embedded Resources), it can do the same thing with Fonts. This means you can put a font file (.ttf or .otf) into your cross platform project and use its EmbeddedResourceId as the value for FontFamily. And this behavior can be extended to Xamarin.Forms elements by use of the Forms9Patch.EmbeddedResourceFontEffect.
Now for a bit of proselytization (please forgive me if this does not apply to you): I see that you used XAML for your sample code. Notice I didn't in my response. If you are new to .Net and/or Xamarin.Forms, I would highly recommend not using XAML. Don't get me wrong, XAML is great - it's just not for beginners. Why? There's just too many things going on under the covers that, as a beginner, will trip you up and slow you down. Rather, I would recommend you write all of your UI in C# so you can learn to manage your properties and learn how binding really works. Once you have mastered making very efficient layouts with the best "context appropriate" use of binding, then you're ready for XAML. For me, the real test was being able to make very a complex cell layout in a large list in a ListView smoothly scroll on a low-end Android phone. After that experience, I was able to take advantage of all the benefits of developing in XAML (and there are many) without worrying about being shackled by my novice mistakes.
I am using Qt4.8 Windows version to develope an application to stream video using libvlc 2.2.1. When I use libvlc_media_player_set_hwnd() to render the video on my QWidget, its rather creating a separate window to display the video.
libvlc_media_player_set_hwnd(m_player, (void*)videoWidget->winId());
I have tried all versions of libvlc and all the examples related to libvlc with Qt. Also followed the steps given in https://wiki.videolan.org/LibVLC_SampleCode_Qt/
But I am not sure if I m missing anything.
It looks like as if libvlc_media_player_set_hwnd() is not able to take the QWidget WinId and creating its own window. However the value of (void*)videoWidget->winId() seems to be a valid one. (I got the value as 0x65).
Please let me know if I am missing anything.
You need to make sure you are configuring your VLC instance correctly first, so that it uses the dummy interface, for example:
/* Load the VLC engine */
std::vector<const char*> options;
options.push_back("--intf=dummy");
return libvlc_new(int(options.size()), options.data());
Also, are you sure you are passing the handle to the correct widget to render on? Also, make sure to set some size on the parent widget, otherwise you may not see anything render at all. Finally, check what media options you are setting to your media player instance, you may be inadvertently telling it to render to generated window.
I've been able to get VLC to work in my own Qt application using the following example as a starting point, even though it is for VLC 1.X:
LibVLC SampleCode Qt - VideoLAN Wiki
I'm in the early stages of development on a game. I'm using images to create animations by drawing a piece of a larger image onto a surface. Here's a code example:
void drawNextFrame() {
//surf.canvas().clear();
surf.clear();
float startX = entity.flipH ? entity.width : 0;
float endX = entity.flipH ? -entity.width : entity.width;
float width = entity.width;
float height = entity.height;
//surf.canvas().drawImage(image, 0, 0,
surf.drawImage(image, 0, 0,
width, height,
(width * curFrame) + startX, 0,
endX, height);
}
surf is the surface of the SurfaceLayer and image is an Image asset. The Java version of this game works wonderfully, it's smooth and responsive and doesn't drop any frames or have any rendering issues. I'm having trouble with the HTML version though, it seems sluggish and drops a lot of frames in the animation. For example I have a run animation for the player that loops, it seems like the HTML version only plays the animation once before the player becomes blank. Jumping or triggering some other animation fixes it so I can play the run animation again, but it still won't play past one iteration of the animation loop before turning the character blank. I also have trouble with surf.clear() firing consistently and sometimes the frames stack on top of each other.
I've done all kinds of debugging to make sure I'm not drawing frames too fast. I'm not touching the paint() method. I tried switching out SurfaceLayer for CanvasLayer, and while that seemed to change the behavior a bit regarding what types of rendering issues I was having and when they were happening, it was still a very unplayable experience. Additionally it was failing to creating mirror images of my images when, for example, the player is facing backwards. I included the commented out code for the Canvas version above--in this case surf is an instance of CanvasImage. I am using Box2D in addition to drawing these animations if that makes a difference.
My question is: is this normal? Am I the only one having these types of issues, and has anybody found a workaround? I just want to make sure I'm not doing something wrong and the approaches I'm taking are valid.
I'm testing with Chrome on a fairly modern machine with the 1.2 branch of PlayN. I build and test the HTML version of my project from the command line via Maven with the following commands:
mvn clean
mvn install
mvn test -Ptest-html
And then I browse to http://localhost:8080 with Chrome.
An additional issue I'm running in to is that refreshing the page doesn't always reload my game. I've implemented an AssetWatcher to make sure everything is available before starting and it works once, generally after I clear my browser cache and restart Chrome, however after that I'm lucky if a refresh loads the game up. Usually I have to repeat the process of clear cache, restart browser to test it again.
I know I'm asking a lot of questions without providing a whole lot of code but I have everything in an SVN repository online and would be happy to open it up to anybody willing to take a look.
Any help is appreciated! Thank you for your time!
Have you looked at the PlayN samples? CuteGame, in particular, seems like it might be relevant. See:
Game Class Immediate Layer Renderer
Cute World paint Method (invoked by renderer in game class)
Cute World paintObjects method (invoked by paint)