Ignore:
Timestamp:
2015-08-04T13:50:35+12:00 (9 years ago)
Author:
davidb
Message:

Development work done in at JCDL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-sites-dev/respooled/collect/popup-video-respooled/js/media-player.js

    r29898 r30093  
    4747
    4848    // Hide the browser's default controls
    49     mediaPlayer.controls = false;
    50    
     49        mediaPlayer.controls = false;
     50
     51        // Make the default volume a little bit quiter, so instruments can be heard over it
     52        mediaPlayer.volume = 0.3
     53   
    5154    // Add a listener for the timeupdate event so we can update the progress bar
    5255    mediaPlayer.addEventListener('timeupdate', updateProgressBar, false);
     
    343346        //console.log("*** set up docStorage: " + JSON.stringify(docStorage));
    344347
    345         var palTracks = docStorage.palTracks;
     348        var palTracks = getPalTracks(docOID);
    346349       
    347350        // Make timing information relative to ba base value
     
    362365        palTracks[save_name] = [ { name: save_name + " 1", baseCTime: base_time_sct, events: recordedNotesArray } ]
    363366
    364         console.log("Storing " + num_rec_notes + " recorded notes as layer '" + save_name +"'");
    365         console.log("**** saved: " + JSON.stringify(palTracks[save_name]));
    366 
    367         localStorage.setItem(docOID, JSON.stringify(docStorage));
     367        //console.log("Storing " + num_rec_notes + " recorded notes as layer '" + save_name +"'");
     368        //console.log("**** saved: " + JSON.stringify(palTracks[save_name]));
     369
     370        //localStorage.setItem(docOID, JSON.stringify(docStorage));
     371
    368372    }
    369373    else {
    370         console.log("Warning: unable to save '" + save_name +"' as browser does not support LocalStorage");
    371     }
    372 
     374        //console.log("Warning: unable to save '" + save_name +"' as browser does not support LocalStorage");
     375    }
     376
     377    saveDocStorage("saveRecording()");
     378         
    373379    var cb_name = save_name.replace(/[ -]/g,"");
    374380    var cb_value = save_name;
     
    386392    return valid;
    387393}
     394
     395
     396function saveNewOverlay()
     397{
     398    var valid = true;
     399
     400    var $save_name_input = $("#create-info-name");
     401    var save_name = $save_name_input.val();
     402   
     403    if (save_name.match(/^\s*$/)) {
     404    valid = false;
     405    $save_name_input.addClass( "ui-state-error" );
     406    }
     407    else {
     408
     409    if (hasLocalStorage) {
     410        var docOID = gs.cgiParams.d;
     411
     412
     413        // Force reset of what has been stored for this item
     414        //localStorage.setItem(docOID, JSON.stringify(null));
     415
     416        var docStorage = getDocStorage(docOID);
     417
     418        var popTracks = getPopTracks(docOID);
     419
     420        var template_webvtt;
     421        template_webvtt = "WEBVTT\n";
     422        template_webvtt += "\n";
     423        template_webvtt += "NOTE Example Popup Info Nugget\n";
     424        template_webvtt += "\n";
     425        template_webvtt += "CueId1\n";
     426        template_webvtt += "00:00.000 --> 00:2.000\n";
     427        template_webvtt += "{\n";
     428        template_webvtt += "\"title\": \"My First Title\",\n";
     429        template_webvtt += "\"text\": \"My first info nugget text\",\n";
     430        template_webvtt += "\"xpos\": \"10px\",\n";
     431        template_webvtt += "\"ypos\": \"30px\"\n";
     432        template_webvtt += "}\n";
     433        template_webvtt += "\n";
     434
     435        popTracks[save_name] = [ template_webvtt ]; // Set up new entry, with exemplar webVTT entry
     436
     437        //console.log("Storing " + num_rec_notes + " recorded notes as layer '" + save_name +"'");
     438        //console.log("**** saved: " + JSON.stringify(palTracks[save_name]));
     439
     440        //localStorage.setItem(docOID, JSON.stringify(docStorage));
     441
     442    }
     443    else {
     444        //console.log("Warning: unable to save '" + save_name +"' as browser does not support LocalStorage");
     445    }
     446
     447    //console.log("***### pop mode, skipping saving for now");
     448    saveDocStorage("saveNewOverlay()");
     449         
     450    var cb_name = save_name.replace(/[ -]/g,"");
     451    var cb_value = save_name;
     452    var name     = save_name;
     453
     454    $('#popList').append('<div id="pop'+cb_name+'"><input type="checkbox" '
     455                 + '" name="'+cb_name+'" value="' + cb_value + '"'
     456                 + ' checked="checked">'
     457                 + name + '</div>');
     458
     459    var $dialog = $('#create-info-popup');
     460    $dialog.dialog( "close" );
     461    }
     462
     463    return valid;
     464}
     465
    388466
    389467
     
    417495    }
    418496    });
    419 
     497    dialog.parent().css("z-index",999);
     498   
    420499    var form = dialog.find( "form" ).on( "submit", function( event ) {
    421500    event.preventDefault();
     
    450529    }
    451530    });
    452 
     531    delete_dialog.parent().css("z-index",999);
    453532
    454533    var edit_dialog = $('#edit-recording-popup').dialog({
     
    479558    }
    480559    });
    481 
     560    edit_dialog.parent().css("z-index",999);
     561   
    482562    trackEditor = ace.edit("trackEditor");
    483563    trackEditor.getSession().setMode("ace/mode/json");
     
    486566    trackEditor.getSession().setUndoManager(new UndoManager());
    487567
     568    //
     569    // Pop layer overlays
     570    //
     571
     572    var new_info_dialog = $('#create-info-popup').dialog({
     573    width : 500,
     574    height: 350,
     575    autoOpen: false, // Do not open on page load
     576    modal: true,     // Freeze the background behind the overlay
     577
     578    show: {
     579            effect: "blind",
     580            duration: 800
     581    },
     582    hide: {
     583            effect: "blind",
     584            duration: 300
     585    },
     586
     587    buttons: {
     588            "Create Overlay": saveNewOverlay,
     589            Cancel: function() {
     590        $(this).dialog("close");
     591            }
     592    },
     593    close: function() {
     594            form[0].reset();
     595            $( "#create-info-name" ).removeClass( "ui-state-error" );
     596    }
     597    });
     598    new_info_dialog.parent().css("z-index",999);
     599
     600    var info_delete_dialog = $('#delete-info-popup').dialog({
     601    resizable: false,
     602    autoOpen: false,
     603    width: 500,
     604    height:200,
     605    modal: true,
     606
     607    show: {
     608            effect: "blind",
     609            duration: 800
     610    },
     611    hide: {
     612            effect: "blind",
     613            duration: 300
     614    },
     615
     616    buttons: {
     617            "Delete selected items": function() {
     618        // call delete
     619        popDeleteConfirmed();
     620        $( this ).dialog( "close" );
     621            },
     622            Cancel: function() {
     623        $( this ).dialog( "close" );
     624            }
     625    }
     626    });
     627    info_delete_dialog.parent().css("z-index",999);
     628
     629
     630    var info_edit_dialog = $('#edit-info-popup').dialog({
     631    resizable: true,
     632    autoOpen: false,
     633    width: 800,
     634    height:600,
     635    modal: true,
     636
     637    show: {
     638            effect: "blind",
     639            duration: 800
     640    },
     641    hide: {
     642            effect: "blind",
     643            duration: 300
     644    },
     645
     646    buttons: {
     647            "Save": function() {
     648        // call delete
     649        popSave();
     650        $( this ).dialog( "close" );
     651            },
     652            Cancel: function() {
     653        $( this ).dialog( "close" );
     654            }
     655    }
     656    });
     657    info_edit_dialog.parent().css("z-index",999);
     658   
     659    infoEditor = ace.edit("infoEditor");
     660    infoEditor.getSession().setMode("ace/mode/text");
     661    infoEditor.getSession().setUseSoftTabs(false);
     662    var InfoUndoManager = require("ace/undomanager").UndoManager;
     663    infoEditor.getSession().setUndoManager(new UndoManager());
     664
     665
     666
     667   
    488668
    489669});
Note: See TracChangeset for help on using the changeset viewer.