diff --git a/index.html b/index.html
index 5f7eb68..be6e215 100644
--- a/index.html
+++ b/index.html
@@ -19,22 +19,24 @@
var lastId, player;
- app.ports.registerVideo.subscribe(function(args) {
- var time = parseInt(args[2], 10) || undefined;
+ if (app.ports !== undefined && app.ports.registerVideo !== undefined) {
+ app.ports.registerVideo.subscribe(function(args) {
+ var time = parseInt(args[2], 10) || undefined;
- requestAnimationFrame(function() {
- if (args[0] !== lastId) {
- lastId = args[0];
+ requestAnimationFrame(function() {
+ if (args[0] !== lastId) {
+ lastId = args[0];
- player = vd.setup(args[0], {
- v: args[1] + "/manifest.mpd",
- t: parseInt(args[2], 10) || 0
- });
- } else if (time !== undefined ){
- player.currentTime(time);
- }
+ player = vd.setup(args[0], {
+ v: args[1] + "/manifest.mpd",
+ t: parseInt(args[2], 10) || 0
+ });
+ } else if (time !== undefined ){
+ player.currentTime(time);
+ }
+ });
});
- });
+ }