@@ -28,7 +28,9 @@ var paths = {
2828 har : 'export.php' ,
2929 waterfall : 'waterfall.php' ,
3030 thumbnail : 'thumbnail.php' ,
31- cancel : 'cancelTest.php'
31+ cancel : 'cancelTest.php' ,
32+ videoCreation : 'video/create.php' ,
33+ videoView : 'video/view.php'
3234} ;
3335
3436var filenames = {
@@ -577,6 +579,35 @@ function listen(local, callback) {
577579 return server . listen . call ( this , local , callback ) ;
578580}
579581
582+ function getEmbedVideoPlayer ( id , options , callback ) {
583+ var params = {
584+ embed : 1 ,
585+ id : id
586+ } ;
587+
588+ options . args = options . args || {
589+ type : 'text/html' ,
590+ encoding : options . dataURI ? 'utf8' : options . encoding
591+ } ;
592+
593+ options . parser = function ( data ) {
594+ return data . toString ( ) ;
595+ } ;
596+
597+ api . call ( this , paths . videoView , callback , params , options ) ;
598+ }
599+
600+ function createVideo ( tests , options , callback ) {
601+ //prefer the json format because the xml format is buggy with wpt 2.11
602+ var params = {
603+ tests : tests ,
604+ f : 'json' ,
605+ end : options . end || 'visual'
606+ } ;
607+
608+ api . call ( this , paths . videoCreation , callback , params , options ) ;
609+ }
610+
580611// WPT constructor
581612function WebPageTest ( server , key ) {
582613 if ( ! ( this instanceof WebPageTest ) ) {
@@ -620,6 +651,8 @@ WebPageTest.prototype = {
620651 getTestInfo : getTestInfo ,
621652 getWaterfallImage : getWaterfallImage ,
622653 getScreenshotImage : getScreenshotImage ,
654+ getEmbedVideoPlayer : getEmbedVideoPlayer ,
655+ createVideo : createVideo ,
623656 scriptToString : WebPageTest . scriptToString ,
624657 listen : listen ,
625658
0 commit comments