iOS Shoutcast access metadata using Swift - ios

Ok so I've looked at many similar stack questions but none of them worked or were too old to even be considered.
Here is the stream adres if that's important: http://51.255.8.139:8822/stream
NOTE: I'm new to iOS programming and this is my first project.
I used AVFoundation. AVAsset to enclose URL and AVPlayer to play it. That works.
I can't however get any metadata from the stream. Like current song name.
Notable things I tried:
asset.timedMetadata nothing there
official apple tutorial availableMetadataFormats was empty
playerItem!.observe(\AVPlayerItem.timedMetadata, options: .new) {
(player, change) in print(change)
}
also empty

For anyone who wants to do the same,
I got the answer on apple developer forum https://developer.apple.com/forums/thread/650170
But basically timedMetadata should work, (prior to iOS 14 it will only give stream name).

Related

YouTube data API change video id

I need to change video I'd, so the URL got changed. Is it possible? As far as I can see from docs - its not supported... So is there any other way to change video URL programmatically?
Example:
When I uploaded video i received URL: youtube.com/watch?v=EMSGJdnDN8U Now (next day) I want to keep uploaded video on server, but i don't want URL youtube.com/watch?v=EMSGJdnDN8U to be available anymore, but the original video should be available on youtube.com/watch?=nEwUrL100500 (new url) and so on...
Of course I know that i can reupload video and delete original one but i dont like that solution.
Sorry, I don’t think so. The video id is a very important identifier for YouTube and it’s very unlikely that they give you control over it.

Getting a rating for a song with Apple Music API

I am trying to get the rating for a song via the Apple Music API, as it describes here.
Hence, the URL I am using is:
https://api.music.apple.com/v1/me/ratings/songs/493341471
493341471 is the playbackStoreID (of the MPMediaItem) of the song 'Born to Die'. I have this song in my library, and I have added it to my "loved" list both on iTunes on my computer and on my iPhone. Yet, when I make this GET request, I get back a 404 Resource not Found error from Apple.
I also tried the same url but using the MPMediaItem property persistentId (its persistentID is 2932020188133715832), and that didn't work either.
The documentation says the url format is
https://api.music.apple.com/v1/me/ratings/songs/{id}
and their example gives a 9 digit id, exactly as the playbackStoreID I used above.
I tried searching the Apple Music catalogue for this song, and the id that was returned was indeed 493341471.
Yet, no matter what I do, I get a resource not found. Anyone have any idea what "id" the documentation here may be referring to?
Seems like you have to like/dislike a specific song with your apple music account then you can get an HTTP 200 response.

Stream to VLC for iOS via URL Scheme

I'm trying to link to the iOS VLC app via its URL scheme. I need to open a FLV file(preferably as a stream, rather than downloading). I have tried vlc://http://domain.com/path/to/video.flv which opens VLC with a popup asking if I would like to play or download. Tapping download works, however play doesn't do anything except close the popup(I can get it to eventually work if I tap Play in the popup -> Play in Control Centre -> tap back in VLC). Is there a way to get it to play by directly through the URL?
Bonus points if you figure out how to select the "Scan for Subtitles" option in the "Open Network Stream" section of VLC. ;)
I've looked all over Google and can't find any documentation of the URL scheme. Any help is greatly appreciated.
the vlc:// pseudo protocol is broken in the current 2.6.4 release - it is fixed in 2.6.5 which is currently waiting for review by Apple. I hope that it will be out this week but this is beyond our control.
Generally speaking, I recommend to use another protocol though based on x-callback-url, documented on our wiki: https://wiki.videolan.org/Documentation:IOS/#x-callback-url
Regarding an extra subtitles URL, this is currently not supported. We could add it though, it's just that nobody asked for it so far.
For those who want to add subtitle it has been added in this commit and can be used like this:
vlc-x-callback://x-callback-url/stream?url=http://example.com/dogs.mp4&sub=https://example.com/dogs.srt

Youtube ?rel=0 tag no longer working

I was trying to share a Youtube link and wanted the person to just see that clip without any of the irrelevant suggestions that pop up next to it. I knew that adding ?rel=0 (or &rel=0) at the end of the URL used to achieve this, but this doesn't seem to be working anymore. After googling a bit, I found suggestions to use the youtu.be domain instead of youtube.com, but suggestions were shown nonetheless, or the URL gave an error. How else can I share this link and have no 'related' clips shown on the side? Thanks!
rel=0 is used to disable related videos shown at the end of a video, not to remove the suggested videos in the sidebars.
You can use the embed URL to access the video on it's own - http://youtube.com/embed/dQw4w9WgXcQ. Add ?rel=0 to disable the related videos at the end too.
Note, that rel=0 no longer works if you are signed into your Google account (YouTube, Gmail, etc).
&rel=0 only works when not signed in. However, you can get around this by using the enhanced privacy mode:
https://www.youtube-nocookie.com/embed/[id]?rel=0
As of August 23, 2018,
The behavior for the rel parameter is changing on or after September
25, 2018. The effect of the change is that you will not be able to
disable related videos. However, you will have the option of
specifying that the related videos shown in the player should be from
the same channel as the video that was just played.
To be more specific:
Prior to the change, if the parameter's value is set to 0, then the player does not show related videos.
After the change, if the rel parameter is set to 0, the player will show related videos that are from the same channel as the video that was just played.

Phone call from Apple Watch with openSystem API?

As I watched the WWDC 2015 session video "Introducing WatchKit for watchOS 2" (at 13:29), I saw that it is possible to make phone calls directly on Apple Watch with the openSystem API. How can I use this API in Swift?
You can use the openSystemURL method, which is available on the shared WKExtension object. Pass a tel: URL to this method to initiate a phone call.
if let telURL=NSURL(string:"tel:5553478") {
let wkExtension=WKExtension.sharedExtension()
wkExtension.openSystemURL(telURL)
}
There seems to be a bug in beta 1 that is not allowing the use of openSystemURL on phone numbers. I've seen several sample projects as well as banged my own head against the wall attempting to get going. No implementation I've seen works. SMS works fine however.

Resources