【问题标题】:JW Player API and Adobe DTM AnalyticsJW Player API 和 Adob​​e DTM 分析
【发布时间】:2015-05-29 13:44:27
【问题描述】:

如何让 jwplayer api 中的函数循环遍历数组的多个对象?例如:

myArray = 'video1', 'video2', 'video3';
//jwplayer api functions
jwplayer().getPosition() and jwplayer().getDuration()
//currently I achieve this by pass an object one at a time like so, 

jwplayer(video2).onPlay(function(event){
 _satellite.track("videostart");
                 var q =  $(".sliderkit-selected a").attr('title'),
                t = jwplayer(video2).getPosition(),
                u = jwplayer(video2).getDuration(),
                initialPos = "-_--_--_--_--_--_--_--_--_--_--_--_-2-_-" + t + '-_-' + u,
                mm = 'Video : ' + _satellite.getVar('Page ID'),
                attr = cmAttributes(_satellite.getVar('cmAttr'));
            cmCreateElementTag(q,mm,initialPos, attr);
 });

我最初编写了一个 for 循环,它只会在 jwplayer.onPlay() 函数上返回正确的视频,同时将视频 1 的值通过 getPosition 和 getDuration 传递给每个选择的视频。 t 和 u 下面的变量是如何将 coremtrics 集成到 adobe dtm 的函数,所以请忽略它。

【问题讨论】:

    标签: javascript adobe adobe-analytics jwplayer6


    【解决方案1】:

    循环通过myArray

    myArray = ['video1', 'video2', 'video3'];
    
    $.each(myArray, function(index, value) { 
    
        ...
    
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多