Instead of using jwplayer().stop()
, you can use jwplayer().pause()
for this, I mostly prefer jwplayer().play(false).
Source : Jwplayer API
LOGIC
just get the parent video wrapper which have all tab (since each tab has two video)... find jwplayer whiich is currently being played and stop all other players.
pauseMedia : function(playingMediaId) {
$('#parent_video_wrapper').find('.jwplayer, object').each(function(){
currentMediaId =$(this).attr('id');
if( jwplayer(this).getState() == "PLAYING" || jwplayer(this).getState() == "BUFFERING" ) {
if(currentMediaId != playingMediaId){
jwplayer(this).play(false);
}
}
});
}
now you can either use above function as pauseMedia() or pauseMedia(mediaId), Both will work
In video Setup if you use it like this
jwplayer("video_"+videoId).setup({
events : {
onPlay : function (callback){
var playingVideoId = 'video_'+videoId;
pauseMedia(playingVideoId);
//pausing other simulatenously playing video in a tab
}
}
});
I think above code might do the trick, just give it a try