Open iTunes with current track via my application - xcode

please help with my problem. I have mobile application of some radiostation. I use AVPlayer for playing music and get metadata, so i need to make search current track or artist(metadata) via iTunes app. I can not find any really important information about search music via my app to iTunes.(I don't want to use JSON from Apple)
So i use this code, it's very simple code but how i am understand iTunes search any information about current artist by this number 17976294 not name artist or name track:
- (IBAction)button:(id)sender {
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:#"https://itunes.apple.com/fr/artist/armin/17976294"]];
}
So maybe you have the same situation, please how to solve my problem.
UPS: So how i am understand it very-very easy, just use direct link (http://itunes.apple.com/search?term=jack+johnson&limit=25) and parse keys which we need.

Related

Google Cast: Get Currently Playing Song from Audio Device

I am trying to use the Google Cast SDK to write a tiny app.
This app should be able to show which (Google casted) song my audio system is currently playing.
This should include info about the track's title, length, artist, album etc.
Using the iOS classes I have managed to connect to the correct GCKDevice via the GCKDiscoveryManager. But how do I get the data about the track which is currently playing?
I would prefer an answer for the iOS classes, but I would also greatly appreciate any hint towards achieving the same with the Chromecast browser extension.
Addon:
On the Cast Developers +-Group I was pointed to this link, thanks Leon! I see that I should register a GCKRemoteMediaClientListener which I could do if I had a GCKRemoteMediaClientobject. The only way to get that seems to be via a GCKSession. I can create such a session from scratch but then the property remoteMediaClient is nil. Or I can ask the GCKCastContext.sharedInstance().sessionManager to start a session for me. But if I do that, the device stops playback immediately.
So I am still a bit lost about how to achieve my initial goal.
Any help please?
After some more help by Leon from the Cast Developer Group, I have figured this one out. The key information is the id of the app which is running on my audio device. I figured that out by the deprecated 2.0 API which is why I will not add this detail.
So assume you have that key, you can initialize yiur cast context by
let options = GCKCastOptions.init(receiverApplicationID: applicationID)
GCKCastContext.setSharedInstanceWith(options)
Next thing is to find your device. This was not too hard (the only thong I figured out by myself :o) and the GCKCastContext.sharedInstance().discoveryManageris your friend here.
If you now start a session via the GCKCastContext.sharedInstance().sessionManager it will not stop the playback. Totally logical in hindsight, makes me wonder which app I started before with that random app id I used...
With the session started you can cast that session to a cast session and add a session listener.
if let session = sessionManager.currentSession as? GCKCastSession {
session.add(self)
}
And when that session notifies its activeness as noted in
func castSession(_ castSession: GCKCastSession, didReceive activeInputStatus: GCKActiveInputStatus)
you can now find the long lost remoteMediaClient and register for his precious events
if let client = castSession.remoteMediaClient {
client.add(self)
}
And this will end the long journey by calling your delegate method
func remoteMediaClient(_ client: GCKRemoteMediaClient, didUpdate mediaMetadata: GCKMediaMetadata)
And if you are as I lucky as I was that media data is quite incomplete.
Mine just contained the title and the release date and nothing else.
Thanks Deezer!
But maybe I can use some id or other obtained in the whole process to get the missing data from the Deezer server? Time will tell.
In the meantime I hope this help somebody with more luck.

NSURLSession with share extension returns -995 on OSX

I'm trying to upload data using NSURLSession with a background task from an OSX share extension.
As soon as I start the task, by delegate is called back with the world's least helpful error message:
The operation couldn’t be completed. (NSURLErrorDomain error -995.)
There's no other information in the NSError object, nor in the console.
After scouring the internet, the only clue I have is to make sure that I've set up the configuration.sharedContainerIdentifier correctly, however I've already done that:
let configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(uniqueId)
configuration.sharedContainerIdentifier = Config.appGroupName
urlSession = NSURLSession.init(configuration: configuration, delegate: self, delegateQueue: nil)
I then prepare the request and create the task:
let task = self.urlSession!.dataTaskWithRequest(request)
self.tasks.append(task)
task.resume()
Note that everything works perfectly when from my main app. It's just the sharing extension that fails.
What other problems could cause error -995?
(Bear with me, I don't have rep yet for a comment so I have to answer, and notwithstanding the possibility you've found a bug, the last part I'm adding might help others)
When you're using an NSURLSession any background upload/download that completes will launch your main application. This is detailed in the Common Scenarios page.
As you show you've done, you need to set the NSURLSessionConfiguration with a sharedContainerIdentifier:
let configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier(uniqueId)
configuration.sharedContainerIdentifier = Config.appGroupName
urlSession = NSURLSession.init(configuration: configuration, delegate: self, delegateQueue: nil)
You also need to ensure that both your app extension and your main app are all triple-checked in the 'App Groups' option in Xcode (I'm looking at Xcode 8.1), which means:
The app group name is the same for both app and extension(!)
the check beside Add the App Group entitlements in the entitlement file
the check beside Add the App Groups feature to your App ID
the check beside Add App Groups to your App ID
And the checks need to be there on both app and extension.
I'm a bit rusty on adding these but my recollection is these aren't listed in the right order, e.g. you have to 'Add App Groups to your ID' before you can check them in both app and extension, but I could be wrong.
Advanced - Thirdparty libraries in app extensions.
Looking at the github project nst/STTwitter, a third-party Twitter REST library, they needed to add a configurable group ID to allow setting the NSURLSessionConfiguration sharedContainerIdentifier to the library user's group ID.
I may again be mistaken but this seems like it would be a general problem when using thirdparty libraries in an app extension - e.g. I've just now come across this error when trying to use the ChromeCast SDK and this could be the kick in the pants.

Access parse current user from Apple Watch

I am making an application for the Apple Watch.
I successfully linked my watch extension to parse. However, I can't access parse data stored on the phone.(In my case PFUser.currentuser() )
What would be the best way to get my current user?
Parse SDK 1.7.2 is out right now and I feel this is exactly what you are looking for.
It brings full support for sharing data with App Extensions and Apple Watch Apps.
Read more in this blog post http://blog.parse.com/announcements/introducing-local-data-sharing-for-apple-watch-and-app-extensions/
Or in the docs on how to set it up: https://parse.com/docs/ios_guide#extensions/iOS

Chromecast new Cast.Api()

I just started using Chromecast SDK today and got bit confused with its APIs and samples given in the web.
What I am trying to do is to send some messages to the Chromecast so it will display them on the big screen. I am going to use Chrome API with HTML5/JS/CSS.
Most examples (https://github.com/pjjanak/chromecast-hello-world/blob/master/sender/index.html , http://nerdwin15.com/2013/10/chromecast-development-part-one-chrome-sender/) in the web uses new Cast.Api() in the sender and uses an Activity in doing so. But I could not find a reference to a Cast.Api in the Chrome API. Most Google references deal with Media and I am not sure whether I have to use them. So to sum up, following are the questions I have (Sorry! I did read the API and developer guide but I am still clueless).
Do I have to write a custom receiver to show text on TV screen. Can't I survive default receiver, chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID
Is handling multimedia files different from displaying text on the Chromecast or can I set the mime type to text/html and send a text stream (doesn't work for me at the moment)
Are those examples on the web uses a deprecated way of sending data to chromecast?
Thanks in advance,
Ish
Ok I think I found the answer from following documents,
https://developers.google.com/cast/docs/receiver_apps
https://github.com/googlecast/CastHelloText-chrome/blob/master/chromehellotext.html
Will try them and let you all know!
Following example page is very useful for anyone who try writing chromecast apps
https://github.com/googlecast
I'm not sure how you fared, but here are some quick responses to your questions.
Yes, you have to write a custom receiver if you want to do anything other than sending images, audio, or video to the Chromecast. You can see a list of supported media Default Media Receiver here: https://developers.google.com/cast/docs/media
Yes (see above), it requires a custom receiver, which will also require your own appId and I'm pretty sure a custom namespace.
To my knowledge, all of the examples up on https://github.com/googlecast should be relevant, but I am working on a few wrappers to try to simplify getting up and running with custom Chrome Sender and Receiver apps. You can check them out here: https://github.com/googlecast Let me know if those help, and if you have any feedback to share.
I hope you've already figured all this stuff out, but if not hopefully this is useful.

Help me build this tool in windows envoirnment

I made a desktop music application in adobe air.
I want to update the status of some IM clients running EG: Yahoo messenger,Gtalk,AIM,MSN etc.
with the current playing song.
I am not desktop developer.This is first time i am making something for desktop.
SO is there any way in any Programming language that i can make something which will change the Data (Status message) of a running IM client.
Please Just guide me through this problem .
Edit: I dont want to ask for username/password of users IMs accounts , so via API is not a solution in this case .
It will be like Person X running mine music application and also logged to various third party IM clients (YIM,Gtalk etc).
SO if he is playing a song in the music application , then mine app will update presence status message on the IM clients to " Listening to bla bla song ".
So it is like high-jacking/Hacking the data of the running third party IM client.
Have a look at libpurple, it might have the functionality you require.
There is also telepathy, but I think it is related to the former somehow (one uses the other or they do the same thing).
EDIT: for the recent edit: it looks to me like you want something like MSN Messenger displaying the currently playing track in Windows Media Player. This requires a plugin for the messaging client, no way around that.
Perhaps an easier way to get this done would be to develop a plugin for one of the numerous multi-platform IM clients such as GAIM or Trillian. This would let you target stuff across the board without undue effort . . .
I think your only option is to write a plugin for each chat client you want to target, which could take some time.
So let me suggest an alternative: Add last.fm audioscrobbler support to your application. You would simply send the Now Playing info to last.fm via the API (http://www.last.fm/api/submissions), and it will appear on the user's profile page. Most music players already support this method because it's a pretty popular service, and a lot of people link to their last.fm profiles on their blog/facebook/etc.

Resources