fix video blob
This commit is contained in:
		@@ -46,6 +46,14 @@ function MediaStreamRecorder(constraints) {
 | 
			
		||||
    };
 | 
			
		||||
    ///@}
 | 
			
		||||
    
 | 
			
		||||
    /// @name private methods
 | 
			
		||||
    ///@{
 | 
			
		||||
    function createURL(data) {
 | 
			
		||||
        var urlCreator = window.URL || window.webkitURL;
 | 
			
		||||
        return urlCreator ? urlCreator.createObjectURL(data) : data;
 | 
			
		||||
    }
 | 
			
		||||
    ///@}
 | 
			
		||||
    
 | 
			
		||||
    /// @name internal event handlers
 | 
			
		||||
    ///@{
 | 
			
		||||
 | 
			
		||||
@@ -95,20 +103,24 @@ function MediaStreamRecorder(constraints) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Get Stream to the Preview
 | 
			
		||||
    /** @return Stream prepared to be used in a HTML @c src attribute
 | 
			
		||||
                within a @c audio or @c video tag. */
 | 
			
		||||
    /** @return Data URL prepared to be used in a HTML @c src
 | 
			
		||||
                attribute within a @c audio or @c video tag. */
 | 
			
		||||
    this.preview = function() {
 | 
			
		||||
        return window.URL ? window.URL.createObjectURL(stream) : stream;
 | 
			
		||||
        return createURL(stream);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Get Stream to the Recording
 | 
			
		||||
    /** @return Stream prepared to be used in a HTML @c src attribute
 | 
			
		||||
                within a @c audio or @c video tag, or to be used in a
 | 
			
		||||
                HTML @c href attribute in a @c a tag for downloading
 | 
			
		||||
                the recording. */
 | 
			
		||||
    this.recording = function() {
 | 
			
		||||
        var buff = new Blob(recordedBlobs, {type: 'video/webm'});
 | 
			
		||||
        return window.URL ? window.URL.createObjectURL(buff) : buff;
 | 
			
		||||
    /** @param callback Callback function that will be called with a
 | 
			
		||||
               data url to be used in a HTML @c src attribute within a
 | 
			
		||||
               @c audio or @c video tag, or to be used in a HTML @c
 | 
			
		||||
               href attribute in a @c a tag for downloading the
 | 
			
		||||
               recording. */
 | 
			
		||||
    this.recording = function(callback) {
 | 
			
		||||
        var reader = new FileReader();
 | 
			
		||||
        reader.onload = function(e) {
 | 
			
		||||
            callback(e.target.result);
 | 
			
		||||
        }
 | 
			
		||||
        reader.readAsDataURL(new Blob(recordedBlobs, {type: 'video/webm'}));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// Start Stream Recording
 | 
			
		||||
 
 | 
			
		||||
@@ -342,6 +342,7 @@ function guessfilename(mimetype, user, date) {
 | 
			
		||||
/// Display Image Attachments
 | 
			
		||||
function attachments(files, id, from, date) {
 | 
			
		||||
    if (files) files.forEach(function(file) {
 | 
			
		||||
        console.log(file);
 | 
			
		||||
        if (!file.name) file.name = guessfilename(file.type, from, date);
 | 
			
		||||
        var a = document.createElement('a');
 | 
			
		||||
        a.href = file.content;
 | 
			
		||||
@@ -373,8 +374,10 @@ var recorder;
 | 
			
		||||
function done() {
 | 
			
		||||
    if (recorder) {
 | 
			
		||||
        recorder.stop();
 | 
			
		||||
        previewfile(recorder.recording(), "video/webm");
 | 
			
		||||
        abort();
 | 
			
		||||
        recorder.recording(function(data) {
 | 
			
		||||
            previewfile(data, "video/webm");
 | 
			
		||||
            abort();
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user