Tuesday, 3 June 2014

Change youtube url to embedded url using javascript in phonegap. Applied for both IOS and Android

Change youtube url to embedded url using javascript in phonegap. Applied for both IOS and Android

here i used iframes to play videos ;


var myId = getId(myUrl);
function getId(url) {
        var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
        var match = url.match(regExp);
        
        if (match && match[2].length == 11) {
            return match[2];
        } else {
            return 'error';
        }
    }


<iframe class='framlist' width='100%' height='250' id='+VideoID+'src='https://www.youtube.com/embed/" + myId + "' seamless></iframe>

No comments:

Setting Up Multiple App Targets in Xcode from a Single Codebase

 To create two different apps (like "Light" and "Regular") from the same codebase in Xcode, you can follow these steps b...