Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic video: check if online or offline #11

Open
Anneleen opened this issue Mar 31, 2013 · 1 comment
Open

Dynamic video: check if online or offline #11

Anneleen opened this issue Mar 31, 2013 · 1 comment

Comments

@Anneleen
Copy link

So I'm making an app that both works online and offline. When there's no connection, it should play the local file (let's just assume for a moment that the user has that file on his phone/tablet). When there is a connection, it should play the video on youtube. I gave it a go, but maybe you can give me some directions?

function showVideo() {
db.transaction(function (tx) {
tx.executeSql('SELECT * FROM ARTIST WHERE VIDEO="yes"', [], function (tx, results) {
var networkState = navigator.network.connection.type;
var len = results.rows.length, i;
for (i = 0; i < len; i++){
if (networkState == Connection.NONE){
window.plugins.videoPlayer.play("'+results.rows.item(i).video_off+'");
}
else{
window.plugins.videoPlayer.play("'+results.rows.item(i).video_on+'");
}
}
document.getElementById("video").innerHTML = home;

}, null);
});
}

@macdonst
Copy link
Owner

macdonst commented Apr 1, 2013

What is going wrong with your code? That is what error do you see?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants