{"action":"created","issue":{"url":"https://api.github.com/repos/julapy/ofxiOSVideoWriter/issues/3","repository_url":"https://api.github.com/repos/julapy/ofxiOSVideoWriter","labels_url":"https://api.github.com/repos/julapy/ofxiOSVideoWriter/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/julapy/ofxiOSVideoWriter/issues/3/comments","events_url":"https://api.github.com/repos/julapy/ofxiOSVideoWriter/issues/3/events","html_url":"https://github.com/julapy/ofxiOSVideoWriter/issues/3","id":180531294,"number":3,"title":"Crashes on 2nd recording","user":{"login":"aferriss","id":3698659,"avatar_url":"https://avatars.githubusercontent.com/u/3698659?v=3","gravatar_id":"","url":"https://api.github.com/users/aferriss","html_url":"https://github.com/aferriss","followers_url":"https://api.github.com/users/aferriss/followers","following_url":"https://api.github.com/users/aferriss/following{/other_user}","gists_url":"https://api.github.com/users/aferriss/gists{/gist_id}","starred_url":"https://api.github.com/users/aferriss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aferriss/subscriptions","organizations_url":"https://api.github.com/users/aferriss/orgs","repos_url":"https://api.github.com/users/aferriss/repos","events_url":"https://api.github.com/users/aferriss/events{/privacy}","received_events_url":"https://api.github.com/users/aferriss/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-02T19:54:57Z","updated_at":"2016-10-12T21:30:02Z","closed_at":null,"body":"The addon works great for the first recording, but if I try to use it more than once after launching the app it crashes with :\r\n\r\n`'NSInvalidArgumentException', reason: '*** -[AVAssetWriter initWithURL:fileType:error:] invalid parameter not satisfying: outputURL != ((void *)0)'`\r\n\r\nFWIW I added the saveMovieToCameraRoll method call finishRecording() to ofxiOSVideoWriter.mm. So now it looks like\r\n````\r\nvoid ofxiOSVideoWriter::finishRecording() {\r\n    if((videoWriter == nil) ||\r\n       [videoWriter isWriting] == NO) {\r\n        return;\r\n    }\r\n    \r\n    [videoWriter finishRecording];\r\n    [videoWriter saveMovieToCameraRoll];\r\n    \r\n    killTextureCache();\r\n    cout<<\"Finishing\"<<endl;\r\n}\r\n````\r\n\r\nAnd in my ofApp I'm calling the videoWriter like so in touchDown:\r\n````\r\n     save = !save;\r\n      if(save){\r\n          videoWriter.startRecording();\r\n      } else {\r\n          videoWriter.finishRecording();\r\n      }\r\n````\r\n\r\nI logged the fileURL being passed into the startRecording method and found that on the second go round the url=null. I traced this to saveMovieToCameraRoll commented out line ~586 which was setting `self.outputUrl = nil;`. Once I did that is seems to save for multiple videos :D"},"comment":{"url":"https://api.github.com/repos/julapy/ofxiOSVideoWriter/issues/comments/253345393","html_url":"https://github.com/julapy/ofxiOSVideoWriter/issues/3#issuecomment-253345393","issue_url":"https://api.github.com/repos/julapy/ofxiOSVideoWriter/issues/3","id":253345393,"user":{"login":"aferriss","id":3698659,"avatar_url":"https://avatars.githubusercontent.com/u/3698659?v=3","gravatar_id":"","url":"https://api.github.com/users/aferriss","html_url":"https://github.com/aferriss","followers_url":"https://api.github.com/users/aferriss/followers","following_url":"https://api.github.com/users/aferriss/following{/other_user}","gists_url":"https://api.github.com/users/aferriss/gists{/gist_id}","starred_url":"https://api.github.com/users/aferriss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aferriss/subscriptions","organizations_url":"https://api.github.com/users/aferriss/orgs","repos_url":"https://api.github.com/users/aferriss/repos","events_url":"https://api.github.com/users/aferriss/events{/privacy}","received_events_url":"https://api.github.com/users/aferriss/received_events","type":"User","site_admin":false},"created_at":"2016-10-12T21:30:02Z","updated_at":"2016-10-12T21:30:02Z","body":"@julapy thanks for the follow up, that makes sense. I also saw [this on the apple docs.](https://developer.apple.com/reference/avfoundation/avassetwriter) \r\n\r\n>You can only use a given instance of AVAssetWriter once to write to a single file. If you want to write to files multiple times, you must use a new instance of AVAssetWriter each time."}}
{"actor":{"display_login":"aferriss"}}