[VLCKit] save rtps stream to ts file not working as it should
Posted: 18 Mar 2015 20:46
Hi,
I use VLCKit and try to create a mac app. I want to save a network stream to a local ts file.
The ts file is created in the correct folder, but the file is only about 150KB and only 1-2 seconds long. But I didn't stopped the recording.
In the example is a rtsp online stream. Normally, I use a local network stream.
When I try to save this example stream (and my local network stream) as a ts file via the VLC.app, this works without any problems. But my code is not working.
Do I miss something?
Here is the code snippet (in Swift language):
Any help is appreciated. Thanks
Marcus
I use VLCKit and try to create a mac app. I want to save a network stream to a local ts file.
The ts file is created in the correct folder, but the file is only about 150KB and only 1-2 seconds long. But I didn't stopped the recording.
In the example is a rtsp online stream. Normally, I use a local network stream.
When I try to save this example stream (and my local network stream) as a ts file via the VLC.app, this works without any problems. But my code is not working.
Do I miss something?
Here is the code snippet (in Swift language):
Code: Select all
import Cocoa
import VLCKit
class TestController: NSViewController, VLCMediaPlayerDelegate {
var vlcStreamSession:VLCStreamSession!
[..]
func createTSFile() {
var urlString:String = "http://daserste_live-lh.akamaihd.net/i/daserste_de@91204/master.m3u8"
var mediaURL:NSURL = NSURL(string: urlString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)!)!
var vlcMedia:VLCMedia = VLCMedia(URL: mediaURL)
var vlcMediaStream:VLCMedia = VLCMedia(URL: mediaURL)
//https://wiki.videolan.org/VLC_command-line_help
vlcMedia.addOptions(["network-caching=10000" : NSNull()])
self.vlcStreamSession = VLCStreamSession()
self.vlcStreamSession.streamOutput = VLCStreamOutput(filePath: "/Users/marcus/Desktop/vlc-output-app.ts")
self.vlcStreamSession.media = vlcMedia
self.vlcStreamSession.startStreaming()
}
}
Marcus