2014-10-03 68 views
0

我試圖製作具有多個視頻提供程序的滑塊,並且需要停止幻燈片切換。 我已成功地在Vimeo和YouTube的合作,withouht使用任何額外的API調用只是Iframe的Dailymotion停止視頻

$('.youtube-iframe')[index].contentWindow.postMessage('{"event":"command","func":"' + 'stopVideo' + '","args":""}', '*'); 

$('.vimeo-iframe')[index].contentWindow.postMessage('{"method":"pause"}', '*'); 

...我已經尋找位DailyMotion,但我不能得到一個例子使用他們的API

任何想法,使IFRAME停止?

回答

1

您好像在vimeo上使用暫停方法 您是否嘗試使用dailymotion player api中的pause()方法?
- >http://www.dailymotion.com/doc/api/player.html

+0

我已經試過的postMessage:有位DailyMotion(「{‘方法’,‘暫停’}」,「*」),但沒有奏效 – Seldimi 2014-10-06 11:15:28

+1

如前所述在[api-reference](http://www.dailymotion.com/doc/api/player.html#api-reference)中,「_API方法是帶有可選參數的簡單字符串。要調用方法,只需傳遞方法名稱作爲使用所選API模式的字符串「。類似'$('。dailmotion-iframe')[index] .contentWindow.postMessage('pause','*');'應該這樣做。 – dhar 2014-10-07 08:03:13

+0

已經嘗試過,沒有工作...... :( – Seldimi 2014-10-13 21:43:40

1

那麼它似乎有可能,iframe的需要加載與& API = postMessage的,那麼你得到一個DOM參考iframe和做:

iframe.contentWindow.postMessage('play', '*'); 

和它的作品。

0

工作代碼爲:

iframe.contentWindow.postMessage('{"command":"pause","parameters":[]}', "*"); 

dailymotion-sdk-js 代碼中使用。

但必須要在iframe的SRC定義api=postMessage參數