I am trying to preview an audio-video stream in Cocoa using QTKit. I succeeded in showing the video, but no audio is heard. This is the code I use:
Code: Select all
// Allocate a VLCVideoView instance and tell it what area to occupy
rect = NSMakeRect(0, 0, 0, 0);
rect.size = [otherPersonView frame].size;
otherPersonVLCView = [[VLCVideoView alloc] initWithFrame:rect];
[otherPersonView addSubview:otherPersonVLCView];
[otherPersonVLCView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
otherPersonVLCView.fillScreen = YES;
otherPersonPlayer = [[VLCMediaPlayer alloc] initWithVideoView:otherPersonVLCView];
NSString *streamName=@"mystream.sdp";
NSString *otherPersonURL=[NSString stringWithFormat:@"rtsp://%@/%@", ip, streamName];
NSString *myURL=[NSString stringWithFormat:@"rtsp://127.0.0.1/%@", streamName];
//-------------------------------
//set stream view
[otherPersonPlayer setMedia:[VLCMedia mediaWithURL:[NSURL URLWithString: otherPersonURL]]];
[otherPersonPlayer play];
Do I need to do something with VLCAudio? Does the audio stream need to be a separate stream? If so, how would I play only the audio? So far I haven't managed to find much documentation about VLCKit apart from the doxygen generated text.
I tried doing something like this, but it also didn't work:
Code: Select all
VLCAudio *audio = [[VLCAudio alloc] init];
audioPlayer = [[VLCMediaPlayer alloc] init];
NSString *someRadio = [NSString stringWithFormat:@"http://4353.live.streamtheworld.com:80/WQHTFMAACCMP3"];
//-------------------------------
//set audio view
[audioPlayer setMedia:[VLCMedia mediaWithURL:[NSURL URLWithString: someRadio]]];
[audioPlayer play];
Thanks in advance!
Drazen