a project by: José Manuel Blasco Galdón
ytCropper, the javascript library to crop YouTube videos inside your website. It is an opensource project, so you can feel free to download it, change it and use it.
Download
Setting the handle values

ytCropper library has methods to set the handle values.


- ytCropper::setInitialValue(value)
Function that changes the initial value of the interval.
value -> Valor en segundos

Returns true if the value is valid and false if not.

- ytCropper::setFinalValue(value)
Función que cambia el valor final del intervalo.
value -> Valor en segundos

Returns true if the value is valid and false if not.

Example:
$("#generateButton").on("click",function(e)
{
    errores = "";
    
        // Prevent the default behaviour of <a> tag
	e.preventDefault();
        // Obtain the first value and put it into #firstInput
    if($("#firstInput").val() != '') // If the #firstInput is set
    {
	    if(!cropper.setInitialValue($("#firstInput").val()))
        {
            errores += "The first value is not valid. ";
        }
    }
        // Obtain the second value and put it into #secondInput
    if($("#secondInput").val() != '') // If the #secondInput is set
    {
	    if(!cropper.setFinalValue($("#secondInput").val()))
        {
            errores += "The second value is not valid ";
        }
    }
            
    $("#generatedCode").val(errores);
    
});


This piece of code take the #firstInput and #secondInput values and set them to the handles. If values are not valid the #generatedCode textfield will show the error.

You can test it here: http://jsfiddle.net/BxQhy/8/

More information about this library in this wiki.


José Manuel Blasco Galdón, 11/04/2014 >