Stop Vimeo Video Using JQuery

I need to stop the Vimeo video embedded in the new oembed api (universal player), but when I try to add an event, I get this error:

Uncaught TypeError: Object #<an HTMLIFrameElement> has no method 'addEvent'

But I don’t understand why I get this error, I added jquery and frogaloop api, also added id to iframes, but it still does not work :: (

The full code is here:

http://tv.bisaccia.info

+3
source share
4 answers

You can not.

  • There is no DOM method addEvent.
  • You do not have cross-domain access to Vimeo, so you are not allowed to have a JavaScript interface with an iframe document or abstract view.

Vimeo JavaScript, API postMessage, .

-2

, , . , . postMessage , DOM, "Froogaloop.init()";

is_embed_iframe = _this.iframe_pattern.test(cur_frame.getAttribute('src')); 

if (is_embed_iframe) {
        cur_frame.api = _that.api;
        cur_frame.get = _that.get;
        cur_frame.addEvent = _that.addEvent;
    }

. froogaloop.js( min) Vimeo.

, iFrame "src" init(), froogaloop .

+2

, :

Froogaloop.init();

API- . :

<iframe id="player_1" src="http://player.vimeo.com/video/26859570?js_api=1&amp;js_swf_id=player_1&amp;title=0&amp;byline=0&amp;portrait=0" width="620" height="354" frameborder="0"></iframe>
<script>
    $(document).ready(function() {
        Froogaloop.init();
        $("#player_1").moogaloop({
            load: function(element) {
                $("#segment1").click(function() { element.moogaloop('seekTo', "7"); });
            }
        });
    });
</script>

... - Moogaloop init(). , .

!

0

, , . Vimeo , DOM. , .

iframe , DOM, . Chrome Safari Mobile.

var container = $("#VimeoContainer");
var iframe = container.find("iframe");
iframe.remove();
container.append(iframe);

, Froogaloop - , , - . , JQuery .

0

Source: https://habr.com/ru/post/1764230/


All Articles