Skip to content
This repository has been archived by the owner on Nov 20, 2021. It is now read-only.

Commit

Permalink
Issue #128 Replace ಠ with IIV
Browse files Browse the repository at this point in the history
  • Loading branch information
binarykitchen authored and bfred-it committed Jun 22, 2017
1 parent 383b7a7 commit 758f7b9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
38 changes: 19 additions & 19 deletions dist/iphone-inline-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ function dispatchEventAsync(element, type) {

var iOS8or9 = typeof document === 'object' && 'object-fit' in document.head.style && !matchMedia('(-webkit-video-playable-inline)').matches;

var = 'bfred-it:iphone-inline-video';
var ಠevent = 'bfred-it:iphone-inline-video:event';
var ಠplay = 'bfred-it:iphone-inline-video:nativeplay';
var ಠpause = 'bfred-it:iphone-inline-video:nativepause';
var IIV = 'bfred-it:iphone-inline-video';
var IIVEvent = 'bfred-it:iphone-inline-video:event';
var IIVPlay = 'bfred-it:iphone-inline-video:nativeplay';
var IIVPause = 'bfred-it:iphone-inline-video:nativepause';

/**
* UTILS
Expand Down Expand Up @@ -109,7 +109,7 @@ var lastTimeupdateEvent;
function setTime(video, time, rememberOnly) {
// Allow one timeupdate event every 200+ ms
if ((lastTimeupdateEvent || 0) + 200 < Date.now()) {
video[ಠevent] = true;
video[IIVEvent] = true;
lastTimeupdateEvent = Date.now();
}
if (!rememberOnly) {
Expand Down Expand Up @@ -146,7 +146,7 @@ function update(timeDiff) {
// // console.assert(player.video.currentTime === player.driver.currentTime, 'Video not updating!');

if (player.video.ended) {
delete player.video[ಠevent]; // Allow timeupdate event
delete player.video[IIVEvent]; // Allow timeupdate event
player.video.pause(true);
}
}
Expand All @@ -158,11 +158,11 @@ function update(timeDiff) {
function play() {
// // console.log('play');
var video = this;
var player = video[];
var player = video[IIV];

// If it's fullscreen, use the native player
if (video.webkitDisplayingFullscreen) {
video[ಠplay]();
video[IIVPlay]();
return;
}

Expand Down Expand Up @@ -198,7 +198,7 @@ function play() {
function pause(forceEvents) {
// // console.log('pause');
var video = this;
var player = video[];
var player = video[IIV];

player.driver.pause();
player.updater.stop();
Expand All @@ -207,7 +207,7 @@ function pause(forceEvents) {
// This is at the end of pause() because it also
// needs to make sure that the simulation is paused
if (video.webkitDisplayingFullscreen) {
video[ಠpause]();
video[IIVPause]();
}

if (player.paused && !forceEvents) {
Expand All @@ -221,7 +221,7 @@ function pause(forceEvents) {

// Handle the 'ended' event only if it's not fullscreen
if (video.ended && !video.webkitDisplayingFullscreen) {
video[ಠevent] = true;
video[IIVEvent] = true;
dispatchEventAsync(video, 'ended');
}
}
Expand All @@ -232,7 +232,7 @@ function pause(forceEvents) {

function addPlayer(video, hasAudio) {
var player = {};
video[] = player;
video[IIV] = player;
player.paused = true; // Track whether 'pause' events have been fired
player.hasAudio = hasAudio;
player.video = video;
Expand Down Expand Up @@ -291,7 +291,7 @@ function addPlayer(video, hasAudio) {
video.pause();

// Play video natively
video[ಠplay]();
video[IIVPlay]();
} else if (hasAudio && player.driver.buffered.length === 0) {
// If the first play is native,
// the <audio> needs to be buffered manually
Expand All @@ -317,15 +317,15 @@ function addPlayer(video, hasAudio) {
}

function preventWithPropOrFullscreen(el) {
var isAllowed = el[ಠevent];
delete el[ಠevent];
var isAllowed = el[IIVEvent];
delete el[IIVEvent];
return !el.webkitDisplayingFullscreen && !isAllowed;
}

function overloadAPI(video) {
var player = video[];
video[ಠplay] = video.play;
video[ಠpause] = video.pause;
var player = video[IIV];
video[IIVPlay] = video.play;
video[IIVPause] = video.pause;
video.play = play;
video.pause = pause;
proxyProperty(video, 'paused', player.driver);
Expand All @@ -350,7 +350,7 @@ function enableInlineVideo(video, opts) {
if ( opts === void 0 ) opts = {};

// Stop if already enabled
if (video[]) {
if (video[IIV]) {
return;
}

Expand Down
38 changes: 19 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import dispatchEventAsync from './lib/dispatch-event-async';

const iOS8or9 = typeof document === 'object' && 'object-fit' in document.head.style && !matchMedia('(-webkit-video-playable-inline)').matches;

const = 'bfred-it:iphone-inline-video';
const ಠevent = 'bfred-it:iphone-inline-video:event';
const ಠplay = 'bfred-it:iphone-inline-video:nativeplay';
const ಠpause = 'bfred-it:iphone-inline-video:nativepause';
const IIV = 'bfred-it:iphone-inline-video';
const IIVEvent = 'bfred-it:iphone-inline-video:event';
const IIVPlay = 'bfred-it:iphone-inline-video:nativeplay';
const IIVPause = 'bfred-it:iphone-inline-video:nativepause';

/**
* UTILS
Expand Down Expand Up @@ -40,7 +40,7 @@ let lastTimeupdateEvent;
function setTime(video, time, rememberOnly) {
// Allow one timeupdate event every 200+ ms
if ((lastTimeupdateEvent || 0) + 200 < Date.now()) {
video[ಠevent] = true;
video[IIVEvent] = true;
lastTimeupdateEvent = Date.now();
}
if (!rememberOnly) {
Expand Down Expand Up @@ -77,7 +77,7 @@ function update(timeDiff) {
// // console.assert(player.video.currentTime === player.driver.currentTime, 'Video not updating!');

if (player.video.ended) {
delete player.video[ಠevent]; // Allow timeupdate event
delete player.video[IIVEvent]; // Allow timeupdate event
player.video.pause(true);
}
}
Expand All @@ -89,11 +89,11 @@ function update(timeDiff) {
function play() {
// // console.log('play');
const video = this;
const player = video[];
const player = video[IIV];

// If it's fullscreen, use the native player
if (video.webkitDisplayingFullscreen) {
video[ಠplay]();
video[IIVPlay]();
return;
}

Expand Down Expand Up @@ -129,7 +129,7 @@ function play() {
function pause(forceEvents) {
// // console.log('pause');
const video = this;
const player = video[];
const player = video[IIV];

player.driver.pause();
player.updater.stop();
Expand All @@ -138,7 +138,7 @@ function pause(forceEvents) {
// This is at the end of pause() because it also
// needs to make sure that the simulation is paused
if (video.webkitDisplayingFullscreen) {
video[ಠpause]();
video[IIVPause]();
}

if (player.paused && !forceEvents) {
Expand All @@ -152,7 +152,7 @@ function pause(forceEvents) {

// Handle the 'ended' event only if it's not fullscreen
if (video.ended && !video.webkitDisplayingFullscreen) {
video[ಠevent] = true;
video[IIVEvent] = true;
dispatchEventAsync(video, 'ended');
}
}
Expand All @@ -163,7 +163,7 @@ function pause(forceEvents) {

function addPlayer(video, hasAudio) {
const player = {};
video[] = player;
video[IIV] = player;
player.paused = true; // Track whether 'pause' events have been fired
player.hasAudio = hasAudio;
player.video = video;
Expand Down Expand Up @@ -222,7 +222,7 @@ function addPlayer(video, hasAudio) {
video.pause();

// Play video natively
video[ಠplay]();
video[IIVPlay]();
} else if (hasAudio && player.driver.buffered.length === 0) {
// If the first play is native,
// the <audio> needs to be buffered manually
Expand All @@ -248,15 +248,15 @@ function addPlayer(video, hasAudio) {
}

function preventWithPropOrFullscreen(el) {
const isAllowed = el[ಠevent];
delete el[ಠevent];
const isAllowed = el[IIVEvent];
delete el[IIVEvent];
return !el.webkitDisplayingFullscreen && !isAllowed;
}

function overloadAPI(video) {
const player = video[];
video[ಠplay] = video.play;
video[ಠpause] = video.pause;
const player = video[IIV];
video[IIVPlay] = video.play;
video[IIVPause] = video.pause;
video.play = play;
video.pause = pause;
proxyProperty(video, 'paused', player.driver);
Expand All @@ -279,7 +279,7 @@ function overloadAPI(video) {

export default function enableInlineVideo(video, opts = {}) {
// Stop if already enabled
if (video[]) {
if (video[IIV]) {
return;
}

Expand Down

0 comments on commit 758f7b9

Please sign in to comment.