CreatePlaylist in soundmanager2 - soundmanager2

How to create a playlist in soundmanager2 using data from a json object or an array?
Does soundmanager2 has native playlist tools or do i have to write my own code like createsound() and destroysound() for each record?

Unless you want a Muxtape-style playlist, you're going to have to make one yourself.

Related

Display a website using cocos2d

I need to load a website in a cocos 2d game.
For example,when a ccmenu button is clicked,i need to replace a scene where it must load an particular website.
Any ideas please,thanks.
It sounds like you want to get game data from a server, correct? In that case, you probably aren't going to want to load an HTML page. Instead, come up with some a method of storing pertinent game data in a more appropriate file format. I can't say for sure because I don't know anything about your game, but saving your game data as XML might work well. Then, when you need to update the game with data from your sever, use an NSURLRequest or similar to download the XML file, which you can then parse as you see fit.
Look into CCHttpRequest or CCHttpClient.

How to get Absolute path for a video using ALAssets Library?

Its simple, How can i get an absolute path for a video retrieved using ALAssets Library? I want to upload this video as file attachment using ASI framework.
It works if i use UIImagePickerViewController. But thats NOT an option any more. I also dont want to use NSData or copy-pasting video to temp file. Need a smart solution? Anybody ?
You can't get the absolute path (file system path) for a video you retrieved using the AssetsLibrary-Framework. The simple reason for that is that these files are outside your app's sandbox and you can't access them directly. You need to use the getBytes-Method of ALAssetsRepresentation to get the byte data of the video file. Most likely you will have to save this data to a temp file, before you can attach it to an email.
Cheers,
Hendrik
You can use ALAssetPropertyAssetURL. From documentation:
The key to retrieve a URL identifier for the asset.
The corresponding value is an NSURL object.
This URL is used by the library-change notifications to identify assets and asset groups. Only the ALAssetRepresentation and ALAssetsGroup classes support this property.
So, once you get ALAsset object you can get url like this:
asset.defaultRepresentation.url

Playlist file(m3u8) give another playlist file infinitely not giving any media file

I have a playlist file which give me another playlist file which also give me another playlist file, continously.
How can I play this playlist file? and Where can I found the source of video?
For example, I have a playlist file. That is
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=355670
http://slive.ytn.co.kr:1935/live/ylive_0624_1.sdp/playlist.m3u8?wowzasessionid=195968950
If I access to http://slive.ytn.co.kr:1935/live/ylive_0624_1.sdp/playlist.m3u8?wowzasessionid=195968950, it give me other playlist files.
#EXTM3U
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:894
#EXTINF:11,
media_894.ts?wowzasessionid=195968950
#EXTINF:10,
media_895.ts?wowzasessionid=195968950
#EXTINF:11,
media_896.ts?wowzasessionid=195968950
If I access to the results, it also give me playlist files.
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=373764
http://slive.ytn.co.kr:1935/live/ylive_0624_1.sdp/playlist.m3u8?wowzasessionid=1093961187
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=382539
http://slive.ytn.co.kr:1935/live/ylive_0624_1.sdp/playlist.m3u8?wowzasessionid=1566364859
etc...
Although I can play the url http://slive.ytn.co.kr:1935/live/ylive_0624_1.sdp/playlist.m3u8?wowzasessionid=195968950 in safari in my iphone, I want to play this url in my own iphone app.
How can I play m3u8 file extension by myself?
EDIT - May be a duplicate of this SO question but if you want to persist the file, you'll need to go the hard way listed below.
Easy way = Embed UIWebView in your app and initialize it with the url of the .m3u8 file. This will open up quicktime which understands m3u8 and it will play it as it downloads.
Hard way = manually create the request/responses for each part of the m3u8 session and then download each .ts file in turn from the playlist file. As you get each "chunk" of the video, write it to a file or memory, then append the next "chunk" after it. I've done this for a h.264 encoded .m4v file served as a m3u8 and it worked (my code is too ugly to paste) but the pseudocode is:
Fetch the m3u8, saving any cookies sent and any headers that may be important*
Parse the .m3u8 (the first file, with the #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=373764) and pull our the urls.
Fetch the playlist from one of the URLs in the .m3u8 file (being sure to keep any headers/cookies in the request that may be necessary)
Parse the playlist file, saving as much metadata as you need from the top part of the file, construct an absolute URL for each .ts path, then stuff it into an array.
Iterate over the array (again, being mindful of cookies/headers) and fetch the content of each .ts URL into a file.
Play the downloaded file with whichever Media Framework you choose (search SO for how to do this)
If you just need to play the files, go the easy route. If you need to persist them, you need to do the m3u8 dance.
*HTTP Scoop is invaluable for seeing how the m3u8 "protocol" works and for making sure you're request/response headers are accurate - http://tuffcode.com/
*I used vanilla NSURLConnection synchronous calls as my code was just a proof of concept, other network frameworks like AFNetworking will make this a lot easier.

Storing data into an XML under iOS

I'm using an NSXMLParser to read data out of a XML, but how can I make my iPhone App storing data into this specific XML.
The case is that I want to create an app to display available dates and one that administrates this dates, whether they are available or not (I'm using an UISwitch to handle this).
Thanks for your answers,
btype.
If you have small amount of data, you can save them in a plist.
See Property List Programming Guide
There's a github project that let's you create XML DOM objects. You can save your XML to your documents folder on the phone.
https://github.com/arashpayan/apxml/

How to get items from feed in iphone?

iam developing RSS Reader, i need to get the items from the given Feed URL.I used Touch XML for this, but this is very slow.Is there any faster way? thanks.
NSXMLParser is the raw XML parser