Preview Clip URL in iOS

173 views
Skip to first unread message

chint...@gmail.com

unread,
Jan 28, 2015, 7:29:21 AM1/28/15
to 7digit...@googlegroups.com
Hi,
I am working on a music streaming app where i have trackID and i want to stream that song.
As streaming music need a Premium 7Digital account, for POC i want to stream only Preview Clip of that song.
In android, I have seen a class "SDIGetTrackPreviewRequest" to get preview URL by TrackId.
I want to do same thing in iOS. I am trying "clip/{trackId}" service, but it is asking me oauth_signature, oauth_timestamp, oauth_nonce, etc.
Can you please help me how can i get this parameters from iOS 7Digital SDK?

Ling Khor

unread,
Feb 24, 2015, 12:33:35 AM2/24/15
to 7digit...@googlegroups.com, chint...@gmail.com
Hi,

Apologies for the slow reply! We have updated the SDK to support preview streams and below is an example. 

--

The cocoapod for 7digital has been updated, so you will need to type

pod update

in your console.

To get a preview for a track you can do the following:

SDTrack *track = [self.sdRelease.tracks objectAtIndex:indexPath.row];
NSURL *preview = [SDMedia previewURLForTrack:track];

// play the track
[self playURL:preview];


- (void)playURL:(NSURL *)url {

    

    AVPlayer *player = [[AVPlayer alloc] initWithURL:url];

    

    self.songPlayer = player;

    

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(playerItemDidReachEnd:)
                                                 name:AVPlayerItemDidPlayToEndTimeNotification
                                               object:[self.songPlayer currentItem]];

    

    [self.songPlayer addObserver:self forKeyPath:@"status" options:0 context:nil];

    

    

    

};


Do let us know if you have any problems.

Thanks,
Ling
Reply all
Reply to author
Forward
0 new messages