From 405727e48e086ef76bb145f15effe636316a7805 Mon Sep 17 00:00:00 2001 From: Carlos Diaz Date: Wed, 27 May 2020 11:54:03 -0400 Subject: [PATCH 1/3] primer commit --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index c5520ae4..18ef4498 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@

PlatziMediaPlayer.js

-

An extensible media player.

+

Una extension de MediaPlayer.

From 07ba1afc1a17f1130a86059e7492a754a2e3d036 Mon Sep 17 00:00:00 2001 From: Carlos Diaz Date: Wed, 27 May 2020 16:23:11 -0400 Subject: [PATCH 2/3] Activacion de boton de play y pause --- index.html | 24 +++++++++++++----------- package.json | 11 ++++++++++- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index 18ef4498..344cf21c 100644 --- a/index.html +++ b/index.html @@ -23,31 +23,33 @@

PlatziMediaPlayer.js

diff --git a/package.json b/package.json index 979f2c7a..a59e439d 100644 --- a/package.json +++ b/package.json @@ -12,5 +12,14 @@ }, "devDependencies": { "live-server": "^1.2.1" - } + }, + "main": "index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/diazpolanco13/javascript-profesional.git" + }, + "bugs": { + "url": "https://github.com/diazpolanco13/javascript-profesional/issues" + }, + "homepage": "https://github.com/diazpolanco13/javascript-profesional#readme" } From 714d14d49adac6be72c3168a37d6699389720194 Mon Sep 17 00:00:00 2001 From: Carlos Diaz Date: Wed, 27 May 2020 16:29:53 -0400 Subject: [PATCH 3/3] Moviendo JS a archivo externo --- assets/index.js | 25 +++++++++++++++++++++++++ index.html | 30 +----------------------------- 2 files changed, 26 insertions(+), 29 deletions(-) create mode 100644 assets/index.js diff --git a/assets/index.js b/assets/index.js new file mode 100644 index 00000000..d6ba7cb4 --- /dev/null +++ b/assets/index.js @@ -0,0 +1,25 @@ +function MediaPlayer(config) { + this.media = config.el + } + + MediaPlayer.prototype.play = function() { + this.media.play(); + } + MediaPlayer.prototype.pause = function() { + this.media.pause(); + } + + MediaPlayer.prototype.toggleplay = function() { + if (this.media.paused) { + this.play(); + } else { + this.pause(); + } + }; + + + const video = document.querySelector("video"); + const player = new MediaPlayer({ el: video }); + + const button = document.querySelector("button"); + button.onclick = () => player.toggleplay(); \ No newline at end of file diff --git a/index.html b/index.html index 344cf21c..a3d15faf 100644 --- a/index.html +++ b/index.html @@ -22,34 +22,6 @@

PlatziMediaPlayer.js

- +