MonoGame cannot load a Song as a non-content file - xna

I've created a game in XNA 4.0 and now want to port it to MonoGame. I'm using the exact same code for my LoadContent method as I did in the original game. However, MonoGame fails to load a song from the content folder and returns an error saying Could not load Example asset as a non-content file. I'm using the following line of code to do it.
Song song = songLoader.Load<Song>("Example");
The song is in the WMA format with a compiled XNB file in the same folder. Both files are set to "Copy if newer". How do I fix the problem?

Related

Add remote USDZ file to local RealityKit .rcproject file and display in QLPreviewController

I'm using AR Quick Look. I have a Reality Composer scene (.rcproject) in my project. I'd like to add a variety of entities to the .rcproject, define triggers and actions AND add a USDZ file from a file at run time.
I can load a remote USDZ file into a QLPreviewController and display it fine as the single QLPreviewItem. I have the URL, covert it to a local file then open it as a preview item.
There are lots of examples of adding entities to an ARView.
But I do not see how I can have a scene defined in Xcode (.rcproject), that I edited with Reality Composer, add a entity (e.g. USDZ file) at run time and display the revised reality file using QLPreviewController and QLPreviewItem.
I can Entity.load(contentsOf: url) to load the .rcproject scene, get the anchor and add a child, which is the USDZ file I got from a remote URL and converted to a local file, but then how do I save that back (the updated anchor or ???) to a .reality file and pass the temporary local file URL as a QLPreviewItem?
Or is there a way to add an entity (USDZ file) to a running QLPreviewController view at run time?
I'm trying to stay with QLPreviewController because I need users to be able to share this AR Quick Look view with other iPhone users so they can open the view in Safari on the iPhone without needing my app.

How to let AVPlayer plays mp3 from URL without waiting to load the whole file in swift

I am playing a file using AVPlayer and it is working fine. What I am looking for is that when the application plays the file it should play as soon as some enough buffer available. Currently what I have noticed is that if the file is big it waits for longer time to start playing the file which means it waits until the file is loaded in the buffer or so.
Any thoughts?
First, thank you Paul, your hint helped.
I have resolved the issue as follow:
Instead of having the URL as the mp3 file; I have created a text file and called it audio.m3u then I have just wrote the url address of my mp3 file in the newly created file (the m3u). Then played the file (audio.m3u) in the AVPlayer.
thats all :)

how can I display and load audio files from iOS app resource/asset folder?

I am fresh to programming and have chosen to learn swift as my first language. I have started playing with the AVFoundation framework. In this case I am working with AVAudioPlayer.
I currently have audio files being loaded through NSURL using the file name and type but I would like to be able to load audio files for each instance of AVAudioPlayer from a list or menu that displays the files currently in the app's resource folder.
This is how I am currently loading my audio files:
var audioPlayer = AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource( "test_kick", ofType: "wav")!), error: nil)
I have searched for hours with no luck and really don't know where to start with this. Any help would be greatly appreciated!
Simon, if I understand your question right, you know how to load a file from the assets, but you want to show a list of the files and play it after a click on a specific file, is that right?
Therefore you will first have to list the folder contents in an UITableView, and react on the click from that TableView to load the selected file into your AVPlayer...
NSFileManager.defaultManager().contentsOfDirectoryAtPath("your path", error: nil)
The above code will give you an array of files inside the path you already have, to be represented in an UITableView
Do you know how to build up a UITableViewDataSource and Delegate?

where to place local video files for android webview html5 hybrid app

I am loading html page from asset folder to android webview, the html pages has video. Other images are loaded clearly but video is not loaded i mean not plays in app. Where to place the local video file? I tested by placing video files in asset folder and raw folder, but not plays video.
webView.loadUrl("file:///android_asset/index.html"); // load html file
video.src="file:///android_res/raw/test.mp4"; // load video file from raw folder
and
video.src="file:///android_asset/test.mp4"; // load video file from assets folder
Please help me, thanks in advance.
I placed video files in RAW folder and access video file in default.html file by following code:
video.src ="android.resource://ProjectPackageAame/raw/test";
video.type = "video/mp4";
video.load();
video.play();
It playes video like i want. Also added following line in AndroidManifest file.
android:hardwareAccelerated="true"
For playing video in full screen mode used showCustomView & hideCustomView method of WebChromeClient. What i have done is kept one Framelayout(customContainer) in my main.xml, and adding view received in showCustomView here, and removing it in onHide. Also hiding/showing webview accordingly.

SWF file extraction

If I have a link to a SWF file - for example here http://redletterdaysb2b.co.uk/swf/our-video.swf
how can I extract it for use on another website?
I have downloaded the swf, but just get an error#2044 when I try and play it. does it need to go in some sort of wrapper?
thanks guys
You're trying to load a swf that in turn loads and displays a .flv using the FLVPlayback component. I'm guessing our-video.swf loads fine, but it probably keeps a relative reference to the .flv.
I can think of two ways to handle this:
Simple add a new FLVPlayback (or any other video player) on the other site but tell it to load the .flv file from the original site.
Try to copy the .flv file in the same folder as the new .swf on the new site.
With the FLVPlayback component there's another part that could cause the error: the skin which on the original site is here.
The #2024 IOError should also include an URL.
This is your best hint to how the our-video.swf is trying to load the .swf file (using a relative(./swf/redletterdays.swf) or an absolute(/swf/redletterdays.swf) path).
Based on this, if you decide to load the player from the original site (not just the .flv file), you can work out where to place the skin (i.e. in the in a folder named swf on the root of the new site)

Resources