Reproduce local video file using XAML and C++ - c++

I am currently making a Windows Universal App starting with an Kinect SDK application called CameraFrames. It's a rather complex app but I am having trouble with playing a video from my local files.
To do this, in one of the main windows of my app I insert a MediaPlayerElement in XAML:
<MediaPlayerElement x:Name="_MediaPlayerElement" AreTransportControlsEnabled="True" HorizontalAlignment="Stretch" Grid.Row="0"/>
As shown in the captur above. Below the XAML file I have a cpp file and a header file. I tried searching on the web for a solution to my problem but couldn't find any. It's my first time using XAML thus I don't know how to connect the different objects that I put on my UI to actual code. The ideal result would be to have the ability to choose from my computer which video file I want to reproduce and then display it on this MediaPlayerElement.

You should set the Source property of your MediaPlayerElement.
If you want to do that in code, use MediaSource.CreateFromStorageFile or CreateFromStream method to create the media source.
Also, UWP apps run in isolated containers. By design, they can’t access files from arbitrary location of your hard drive. Read this article for more info.

Related

program NSTouchBar with c++

The problem
I would like to use c++ to create an application that uses the new macbook pro touch bar. However I am not able to find any really good resources. And apple does not have any docs on using c++ to program the touch bar.
What I have done
I found this article on c++ and the touch bar, However I cannot find either of the header files for the script GLFW/glfw3.h and GLFW/glfw3native.h. These both seem critical to the script working.
More on the issue
Even if the above article's script works, there are no official docs for programing the touch bar with c++ (That I know of). I think that this is an important thing to have given the fact that many, if not most applications are written in c/c++.
Thank you in advance for the help!
So the article that you link to basically does not need the GLFW/glfw3.h and GLFW/glfw3native.h files if you are not using GLFW.
What UI framework are you using for your C++ app?
Unless it is still using Carbon, at the lowest level, the framework will be creating NSWindows to actually have windows in the UI. You need to get access to the NSWindow that your framework is using to host it the UI. If it is still using Carbon, I think you are probably not going to be able to accomplish this.
If the framework provides some mechanism to get the native platform window (which will be an NSWindow), you would replace the author's call to glfwGetCocoaWindow(window); with the correct call from your framework.
If the framework does not provide access to the NSWindow, then you will need to use the code that is commented out at the bottom of the article to attach your touchbar to the windows in your app.
Please note that all that code is Obj-C code; you'll need to have at least one .m or .mm file in your project to provide that Obj-C glue code to get access to the touchbar. Basically that code is a C-calleable wrapper around the Cocoa API.
Also note that you'll need to expand the list of buttons and actions for all the different things you want to put in the touchbar. You could add your own wrapping API so that the construction of the toolbar is done from C++ and registers actions that call-back into your C++ app to handle the events.
Fundamentally though, the touchbar is not available on any other platform, so there is no great benefit to trying to avoid writing Obj-C to implement your touchbar as that code will only run on macOS anyway. If you use .mm files to implement Obj-C++ for this code, you can still call into your C++ objects from your touchbar code.

How to bundle/store application image data in my OpenCV iOS application?

I am new to Xcode and iOS development and I have a basic question about how to store (bundle) application data that consist of images needed by my application. My application requires a small database of images as input that I supply.
I have an Xcode project in C++ that uses OpenCV that is currently compiled and running correctly on my Mac. The application on my Mac simply reads the image data it needs from a folder on my file system that I can easily point to. I am trying to port this application to iOS using either Objective-C or Swift. I was able to write some basic Objective-C code as a wrapper to my C++/OpenCV application but I am now at the point where I need to access the iOS file system to read the images and I am not sure where to locate that data and how to configure my Xcode project to include it.
After doing some reading on this topic I see that there are several ways to store data in iOS, but I am uncertain about what approach would be appropriate and relatively easy to implement. My understanding is that all the data for my app needs to live in the application sandbox. I see plenty of examples for how to get the file path for various folders in the sandbox, but it is not clear to me how to actually configure my project to include the data (i.e., where do I put my images?). Is there something I need to configure within my Xcode project so that when I compile the application it knows about my data?
I found many posting about the iOS file system, Core data, archiving data, etc… but had a hard time locating any information about how to actually configure my project with data that I supply. Any help would be greatly appreciated.
Thank you!
If the images that you are supplying are fixed in the app (ie- not changing over time) then you simply add the images to the app itself. They are stored in the app bundle and can be accessed as follows (with sample names);
let imagePath = NSBundle.mainBundle().pathForResource("myImage", ofType:"jpg")
let splashImageURL = NSURL.fileURLWithPath(imagePath!)
anImage = NSImage(contentsOfURL:splashImageURL)
You can create a folder in the project to hold the images. This is not used in the final image path, only for convenience in the project. You can use the File menu or drag and drop image files directly into the project. Make sure to check the 'copy files' option to move the images from your source location into the project itself.

Best way to disable a file in Windows File Explorer?

I am working on a virtual file system on windows in C++,
I am currently looking for a Windows API to make a file visible but not accessible in Windows 7 and Higher,
Picture example
the best option I could found is to use FILE_ATTRIBUTE_OFFLINE attribute,
but this solution implies to have the windows [X] grey overlay on files,
Offline Files
I already found this related post explaining the issue of file explorer multiple access if I hook the behavior at kernel side :
Keep windows trying to read a file,
is there an other way to look at the problem I omited, or a better option ?

How to access the picture file on iPod/iPhone?

When I connect the iPod (or iPhone) to the Windows PC,
it look like an USB drive, but I can't open a file on it because I can't know the correct file path.
I was also unable to drop the file to my application because the drag source does not have CF_HDROP.
Some applications can open a file on iPod, but it was a copy on the local temp folder.
screenshot http://img862.imageshack.us/img862/5396/ipodx.png
My question is ..
How can I directly (programmatically) open and read the picture file on iPod?
If I double click on it (or right click and select Preview menu),
it launches Windows Photo Viewer -- it is not my default picture viewer.
Can I change the file (.PNG) association to other application?
What's the viewer application's requirement to be a default viewer for files on ipod?
Applications that do that use Picture Transfer Protocol (PTP). On Windows Microsoft implements many interfaces as part of Windows Image Acquisition (WIA). Read more here: http://msdn.microsoft.com/en-us/library/ms630344(v=VS.85).aspx
http://support.microsoft.com/kb/307859 or manually edit registry at HKEY_CLASSES_ROOT\.png
Try the iPhoneBrowser program. It should give you a fair idea of the path.
From everything I've read I don't think Apple gives you access to the file system on the iPhone / iTouch / iPad; they want you to use iTunes to transfer files back and forth. I believe the Android and Windows Phone environments have similar restrictions. (If you "jailbreak" or "root" your device that's obviously a different story, which is why many such utilities explicitly state they only work on rooted devices.)
In part, this is a security precaution: if it were possible to directly access the file system on the mobile device it would be that much easier for someone to plant malware on your phone or PDA.
For this reason, updates to the various mobile OSes frequently include changes to (1) make jailbreaking more difficult and/or (2) close the loopholes that allow software like the iPhoneBrowser to work.
Some of the portable music players that use (Windows) Media Player have similar limitations. For example, I had a Sansa m100 (I think) where I could just drag files to the device and the playlist would automatically get updated; on at least some of the newer models (eg the c200) you have to use Media Player to download content. Which to me is annoying since there doesn't seem to be a way to use Media Player to delete content from the device.
There probably are APIs to do this sort of thing, but I would guess they're somewhat specific to the platform you're using -- ie I don't think you're going to be able to just use CreateFile() or something like that.

iMX31 dependencies?

I am beginner in an silverlight application. So at first i looked on demo application which is provided by wince 6.0 r3 at location
WINCE600\PUBLIC\COMMON\OAK\DEMOS\XAMLPERF - this contains c++ code
and
WINCE600\PUBLIC\COMMON\OAK\FILES\XAMLPERF - this contains xaml file with the images
Now before running this application in an emulator. I at first proceeded with the following:
I have first taken my workspace went to catalog item and added "Silverlight for Windows Embedded"
from the drop down menu of an catalog item
Then right clicked on solution explorer and choosed on properties and under configuration in drop down menu i have selected environment variables where i have added new variable called "sysgen_samplexamlperf" and assigned value as 1 for that variable.
Now after rebuiding the application, i have dumped the image into emulator and i found that at desktop of device emulator i can see the exe file to which i run and i can see the application is working fine with 3d effects.
Now same thing i proceeded in iMX31 hardware and i was not able to see the application running in a proper manner as it was performing in an emulator. So now what i feel is that there be any dependency when we run the application on hardware.
So what can be the dependency? Also in this location "WINCE600\PUBLIC\COMMON\OAK\FILES\XAMLPERF" the images are in png format. So is there any dependency with an image format?
Thanks and regards
Silverlight for Embedded devices does not require HW support. You can add hardware support to enhance performance, but it is not a requirement.
On my PXA3XX platform for example, Silverlight runs without any HW tweaks through the driver.
What is your question exactly? Where is the demo application?
You can just as well add the XAML based internet explorer to make sure it Silverlight runs. Be aware that the XAML based IE does not have a shortcut on the desktop so you need to create one by yourself or just run the executable from \Windows