How to use the current-device.mobile function in current-device

To help you get started, we’ve selected a few current-device examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aliyunvideo / AliyunPlayer_Web / customComponents / src / components / VideoADComponent / index.js View on Github external
// 播放视频广告
  playVideoAd () {
    this.setAdInterval()
    this.player.play()
  }

  // 暂停视频广告 
  pauseVideoAd () {
    this.clearAdInterval()
    this.player.pause()
  }
}

let defaultComponent = VideoAdComponent

if (device.mobile()) {
  defaultComponent = MbVideoAdComponent
}

export default defaultComponent
github aliyunvideo / AliyunPlayer_Web / customComponents / src / components / ManyVideoADComponent / index.js View on Github external
manyVideoAd_ele.play()
    manyVideoAd_ele.addEventListener('ended', function(event) {
      let flag = self.playNext(self)
      //广告结束之后自动播放主视频
      if(flag == '-1'){
        document.getElementById('player-con').getElementsByTagName('video')[0].play()
        let controlBar = document.querySelector('.prism-controlbar')
        controlBar.className = controlBar.className.replace(' controlbar-element-hidden', '')
      }
    })
  }
}

let defaultComponent = ManyVideoAdComponent

if (device.mobile()) {
  defaultComponent = MbManyVideoAdComponent
}

export default defaultComponent
github neophob / wpc-emu / client / scripts / lib / device-detection.js View on Github external
function isMobileBrowser() {
  return device.mobile();
}

current-device

The easiest way to write conditional CSS and/or JavaScript based on device operating system (iOS, Android, Blackberry, Windows, Firefox OS, MeeGo, AppleTV, etc), orientation (Portrait vs. Landscape), and type (Tablet vs. Mobile).

MIT
Latest version published 4 years ago

Package Health Score

64 / 100
Full package analysis