List video HTML

WebDevTrick

00:00
00:00
00:00

How we can create a scrolling navigation bar using HTML and CSS? Solution: Horizontal Scroll Navigation Using HTML CSS, Scrolling Menu Bar.

Comming Next

CSS Clip-Path

Built in Pure CSS

How we can create an animated hover effect card using CSS clip-path? Solution: CSS Clip Path Animation Card, Clip-Path Hover Cards.

Bar Graphs

Built in JavaScript

How we can create Bar Graphs With Animation using JavaScript, HTML, & CSS? Solution: JavaScript Animated Bar Graph. In Other Words, Bar Chart With Animation Effects.

Login Page

Pure HTML & CSS

How we can create an animated login page design using HTML and CSS? Solution: Animated Login Page In HTML CSS, Example and Source Code.

Horizontal Scroll Menu

Built in HTML CSS

How we can create a scrolling navigation bar using HTML and CSS? Solution: Horizontal Scroll Navigation Using HTML CSS, Scrolling Menu Bar.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

  

  HTML Advance Video Player | Webdevtrick.com

  

  

  

    

      

        

HTML 5 Video Player

        Code By WebDevTrick

      

      

        

          

          

                        

          

            

            00:00

            

              

              

              

            

            

00:00

            00:00

            

            

          

        

        

          

            

How we can create a scrolling navigation bar using HTML and CSS? Solution: Horizontal Scroll Navigation Using HTML CSS, Scrolling Menu Bar.

          

        

      

      

        Comming Next

        

          

          

CSS Clip-Path

          

Built in Pure CSS

            How we can create an animated hover effect card using CSS clip-path? Solution: CSS Clip Path Animation Card, Clip-Path Hover Cards.

            

        

        

          

          

Bar Graphs

          

Built in JavaScript

          How we can create Bar Graphs With Animation using JavaScript, HTML, & CSS? Solution: JavaScript Animated Bar Graph. In Other Words, Bar Chart With Animation Effects.

            

        

        

          

          

Login Page

          

Pure HTML & CSS

            How we can create an animated login page design using HTML and CSS? Solution: Animated Login Page In HTML CSS, Example and Source Code.

            

        

        

          

          

Horizontal Scroll Menu

          

Built in HTML CSS

            How we can create a scrolling navigation bar using HTML and CSS? Solution: Horizontal Scroll Navigation Using HTML CSS, Scrolling Menu Bar.

        

      

    

  

  

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

style.css

/** Code By Webdevtrick [ //webdevtrick.com ] **/ @import url[//weloveiconfonts.com/api/?family=fontawesome]; [class*="fontawesome-"]:before { font-family: 'FontAwesome', sans-serif; } body { background: #e8eaed; font: 16px/1.5 "Source Sans Pro", "Helvetica Neue", Arial, sans-serif; } img { max-width: 100%; } h2 { font-weight: 400; font-size: 1.5rem; } a { color: inherit; text-decoration: none; box-shadow: inset 0px -1px 0px rgba[255, 255, 255, 0.5]; transition: all 0.5s; } a:hover { box-shadow: inset 0px -24px 0px #61b5d9; } .wrapper { margin: 0 auto; padding: 0 1em; max-width: 69rem; } .truncate, .video-title, .single-video-title, .single-video-info { box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; } .video-area { -webkit-animation-delay: 0.5s; animation-delay: 0.5s; -webkit-animation-fill-mode: both; animation-fill-mode: both; color: #fff; padding: 4.5rem 0; } .video-column { float: left; max-width: 854px; } .video-player { background: #000; position: relative; overflow: hidden; width: 100%; height: 480px; } .video { display: block; cursor: pointer; width: 100%; position: relative; top: 50%; -webkit-transform: translateY[-50%]; transform: translateY[-50%]; } .playlist { float: right; font-size: 18px; font-weight: 600; max-width: 250px; } .video-header { background: #e60023; line-height: 1.5rem; padding: 1.5rem; } .video-title { float: left; margin: 0; width: auto; max-width: 75%; } .video-author { font-size: 18px; float: left; margin-left: 3rem; } .description { color: #212121; } .video-author a:hover { box-shadow: inset 0px -24px 0px #212121; } .video-controls { box-sizing: border-box; background: rgb[33,33,33, 0.8]; line-height: 3rem; padding: 0 1.5rem; position: absolute; bottom: 0; -webkit-transform: translate3d[0, 3rem, 0]; transform: translate3d[0, 3rem, 0]; width: 100%; height: 3rem; vertical-align: middle; transition: -webkit-transform 0.5s; transition: transform 0.5s; transition: transform 0.5s, -webkit-transform 0.5s; } .video-controls button { background: 0; border: 0; color: #fff; font-size: 1.5rem; width: 3rem; height: 3rem; vertical-align: middle; } .video-player:hover .video-controls { -webkit-transform: translate3d[0, 0, 0]; transform: translate3d[0, 0, 0]; } .video-bars { background: rgb[33,33,33, 0.8]; display: inline-block; margin: 0 1em; position: relative; width: 73%; height: 8px; } .bar-seeker, .bar-progress, .bar-buffer { position: absolute; height: 8px; } .bar-seeker { z-index: 1000; } .bar-progress { z-index: 100; } .bar-buffer { z-index: 10; } input[type=range] { background: transparent; cursor: pointer; -webkit-appearance: none; width: 100%; } input[type=range]::-webkit-slider-runnable-track { -webkit-appearance: none; } input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; } input[type=range]:focus { outline: none; } input[type=range]::-ms-track { width: 100%; cursor: pointer; background: transparent; border-color: transparent; color: transparent; } .bar-seeker::-ms-fill-lower { background: transparent; } .bar-seeker::-ms-fill-upper { background: transparent; } .bar-seeker::-webkit-slider-runnable-track { background: transparent; height: 8px; padding: 0; } .bar-seeker::-moz-range-track { background: transparent; height: 8px; padding: 0; } .bar-seeker::-ms-track { background: transparent; height: 8px; padding: 0; } .bar-seeker::-webkit-slider-thumb { background: #ff3c3c; border: 0; border-radius: 100%; width: 18px; height: 18px; margin-top: -4px; } .bar-seeker::-moz-range-thumb { background: #ff3c3c; border: 0; border-radius: 100%; width: 18px; height: 18px; margin-top: -4px; } .bar-seeker::-ms-thumb { background: #ff3c3c; border: 0; border-radius: 100%; width: 18px; height: 18px; margin-top: -4px; } @media all and [-ms-high-contrast: none], [-ms-high-contrast: active] { .bar-seeker { height: 24px; margin-top: -5px; padding: 0; vertical-align: middle; } } input.slider-volume { position: absolute; bottom: 36px; right: -40px; width: 6rem; opacity: 0; -webkit-transform: rotate[-90deg] scaleX[0]; transform: rotate[-90deg] scaleX[0]; -webkit-transform-origin: left; transform-origin: left; transition: all 1s; } .slider-volume::-webkit-slider-runnable-track { background: rgb[33,33,33, 0.8]; height: 20px; } .slider-volume::-moz-range-track { background: rgb[33,33,33, 0.8]; height: 20px; } .slider-volume::-ms-track { background: rgb[33,33,33, 0.8]; height: 20px; } .slider-volume::-webkit-slider-thumb { background: #ff3c3c; border: 0; width: 8px; height: 24px; margin-top: -2px; } .slider-volume::-moz-range-thumb { background: #ff3c3c; border: 0; width: 8px; height: 24px; margin-top: -2px; } .slider-volume::-ms-thumb { background: #ff3c3c; border: 0; width: 8px; height: 24px; margin-top: -2px; } .btn-sound:hover + .slider-volume, .slider-volume:hover { opacity: 1; -webkit-transform: rotate[-90deg] scaleX[1]; transform: rotate[-90deg] scaleX[1]; } progress { -webkit-appearance: none; -moz-appearance: none; appearance: none; background: transparent; color: rgba[255, 255, 255, 0.2]; border: none; height: 8px; width: 100%; } progress::-webkit-progress-bar { background: transparent; } progress::-webkit-progress-value { background: transparent; } .bar-buffer::-webkit-progress-value { background: rgba[255, 255, 255, 0.2]; } .bar-buffer::-moz-progress-bar { background: rgba[255, 255, 255, 0.2]; } .bar-progress::-webkit-progress-value { background: #ff3c3c; } .bar-progress::-moz-progress-bar { background: #ff3c3c; } .bar-progress { color: #ff3c3c; } .btn-replay { background: none; border: none; display: none; color: #ff3c3c; position: absolute; top: 50%; left: 50%; margin-left: -110px; margin-top: -110px; font-size: 9rem; width: 220px; height: 220px; } .time-bubble { background: #61b5d9; border-radius: 1.5rem 1.5rem 0px; height: 1.5rem; line-height: 1.5rem; position: absolute; bottom: 3.2rem; left: 4.8rem; padding: 0.5em; display: none; } .next { background: #212121; padding: 16.5px; max-height: 60px; } .next-video { display: block; height: 140px; position: relative; overflow: hidden; } .next-video img { display: block; } .next-video::before { background: linear-gradient[0deg, rgb[33,33,33, 0.8] 0%, transparent 60%]; content: ""; width: 100%; height: 100%; position: absolute; transition: all 0.5s; } .single-video-title { position: absolute; -webkit-transform: translateY[-4.5rem]; transform: translateY[-4.5rem]; padding: 0.75rem 1.5rem; transition: all 0.5s; } .single-video-info { box-sizing: border-box; font-size: 14px; font-weight: 400; padding: 0.75rem 1.5rem; position: absolute; -webkit-transform: translateY[-6.75rem]; transform: translateY[-6.75rem]; transition: all 0.5s; opacity: 0; width: 100%; } .next-video:hover .single-video-title { -webkit-transform: translateY[-9.75rem]; transform: translateY[-9.75rem]; } .next-video:hover::before { background: rgb[33,33,33, 0.7]; } .next-video:hover .single-video-info { opacity: 1; } .played-video { -webkit-transform: scale[0]; transform: scale[0]; height: 0; width: 0; } .info-area { background: #fff; color: #212121; } .info-heading { color: #61b5d9; font-size: 3rem; font-weight: 300; text-align: center; margin: 4.5rem auto; } .clearfix:before, .wrapper:before, .video-header:before, .clearfix:after, .wrapper:after, .video-header:after { content: " "; display: table; } .clearfix:after, .wrapper:after, .video-header:after { clear: both; } @-webkit-keyframes bottomSlide { 0% { -webkit-transform: translate3d[0, 100%, 0]; transform: translate3d[0, 100%, 0]; opacity: 1; } 100% { opacity: 1; } } @keyframes bottomSlide { 0% { -webkit-transform: translate3d[0, 100%, 0]; transform: translate3d[0, 100%, 0]; opacity: 1; } 100% { opacity: 1; } }

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

/** Code By Webdevtrick [ //webdevtrick.com ] **/

@import url[//weloveiconfonts.com/api/?family=fontawesome];

[class*="fontawesome-"]:before {

  font-family: 'FontAwesome', sans-serif;

}

body {

  background: #e8eaed;

  font: 16px/1.5 "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;

}

img {

  max-width: 100%;

}

h2 {

  font-weight: 400;

  font-size: 1.5rem;

}

a {

  color: inherit;

  text-decoration: none;

  box-shadow: inset 0px -1px 0px rgba[255, 255, 255, 0.5];

  transition: all 0.5s;

}

a:hover {

  box-shadow: inset 0px -24px 0px #61b5d9;

}

.wrapper {

  margin: 0 auto;

  padding: 0 1em;

  max-width: 69rem;

}

.truncate, .video-title, .single-video-title, .single-video-info {

  box-sizing: border-box;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

  width: 100%;

}

.video-area {

  -webkit-animation-delay: 0.5s;

          animation-delay: 0.5s;

  -webkit-animation-fill-mode: both;

          animation-fill-mode: both;

  color: #fff;

  padding: 4.5rem 0;

}

.video-column {

  float: left;

  max-width: 854px;

}

.video-player {

  background: #000;

  position: relative;

  overflow: hidden;

  width: 100%;

  height: 480px;

}

.video {

  display: block;

  cursor: pointer;

  width: 100%;

  position: relative;

  top: 50%;

  -webkit-transform: translateY[-50%];

          transform: translateY[-50%];

}

.playlist {

  float: right;

  font-size: 18px;

  font-weight: 600;

  max-width: 250px;

}

.video-header {

  background: #e60023;

  line-height: 1.5rem;

  padding: 1.5rem;

}

.video-title {

  float: left;

  margin: 0;

  width: auto;

  max-width: 75%;

}

.video-author {

  font-size: 18px;

  float: left;

  margin-left: 3rem;

}

.description {

  color: #212121;

}

.video-author a:hover {

  box-shadow: inset 0px -24px 0px #212121;

}

.video-controls {

  box-sizing: border-box;

  background: rgb[33,33,33, 0.8];

  line-height: 3rem;

  padding: 0 1.5rem;

  position: absolute;

  bottom: 0;

  -webkit-transform: translate3d[0, 3rem, 0];

          transform: translate3d[0, 3rem, 0];

  width: 100%;

  height: 3rem;

  vertical-align: middle;

  transition: -webkit-transform 0.5s;

  transition: transform 0.5s;

  transition: transform 0.5s, -webkit-transform 0.5s;

}

.video-controls button {

  background: 0;

  border: 0;

  color: #fff;

  font-size: 1.5rem;

  width: 3rem;

  height: 3rem;

  vertical-align: middle;

}

.video-player:hover .video-controls {

  -webkit-transform: translate3d[0, 0, 0];

          transform: translate3d[0, 0, 0];

}

.video-bars {

  background: rgb[33,33,33, 0.8];

  display: inline-block;

  margin: 0 1em;

  position: relative;

  width: 73%;

  height: 8px;

}

.bar-seeker,

.bar-progress,

.bar-buffer {

  position: absolute;

  height: 8px;

}

.bar-seeker {

  z-index: 1000;

}

.bar-progress {

  z-index: 100;

}

.bar-buffer {

  z-index: 10;

}

input[type=range] {

  background: transparent;

  cursor: pointer;

  -webkit-appearance: none;

  width: 100%;

}

input[type=range]::-webkit-slider-runnable-track {

  -webkit-appearance: none;

}

input[type=range]::-webkit-slider-thumb {

  -webkit-appearance: none;

}

input[type=range]:focus {

  outline: none;

}

input[type=range]::-ms-track {

  width: 100%;

  cursor: pointer;

  background: transparent;

  border-color: transparent;

  color: transparent;

}

.bar-seeker::-ms-fill-lower {

  background: transparent;

}

.bar-seeker::-ms-fill-upper {

  background: transparent;

}

.bar-seeker::-webkit-slider-runnable-track {

  background: transparent;

  height: 8px;

  padding: 0;

}

.bar-seeker::-moz-range-track {

  background: transparent;

  height: 8px;

  padding: 0;

}

.bar-seeker::-ms-track {

  background: transparent;

  height: 8px;

  padding: 0;

}

.bar-seeker::-webkit-slider-thumb {

  background: #ff3c3c;

  border: 0;

  border-radius: 100%;

  width: 18px;

  height: 18px;

  margin-top: -4px;

}

.bar-seeker::-moz-range-thumb {

  background: #ff3c3c;

  border: 0;

  border-radius: 100%;

  width: 18px;

  height: 18px;

  margin-top: -4px;

}

.bar-seeker::-ms-thumb {

  background: #ff3c3c;

  border: 0;

  border-radius: 100%;

  width: 18px;

  height: 18px;

  margin-top: -4px;

}

@media all and [-ms-high-contrast: none], [-ms-high-contrast: active] {

  .bar-seeker {

    height: 24px;

    margin-top: -5px;

    padding: 0;

    vertical-align: middle;

  }

}

input.slider-volume {

  position: absolute;

  bottom: 36px;

  right: -40px;

  width: 6rem;

  opacity: 0;

  -webkit-transform: rotate[-90deg] scaleX[0];

          transform: rotate[-90deg] scaleX[0];

  -webkit-transform-origin: left;

          transform-origin: left;

  transition: all 1s;

}

.slider-volume::-webkit-slider-runnable-track {

  background: rgb[33,33,33, 0.8];

  height: 20px;

}

.slider-volume::-moz-range-track {

  background: rgb[33,33,33, 0.8];

  height: 20px;

}

.slider-volume::-ms-track {

  background: rgb[33,33,33, 0.8];

  height: 20px;

}

.slider-volume::-webkit-slider-thumb {

  background: #ff3c3c;

  border: 0;

  width: 8px;

  height: 24px;

  margin-top: -2px;

}

.slider-volume::-moz-range-thumb {

  background: #ff3c3c;

  border: 0;

  width: 8px;

  height: 24px;

  margin-top: -2px;

}

.slider-volume::-ms-thumb {

  background: #ff3c3c;

  border: 0;

  width: 8px;

  height: 24px;

  margin-top: -2px;

}

.btn-sound:hover + .slider-volume,

.slider-volume:hover {

  opacity: 1;

  -webkit-transform: rotate[-90deg] scaleX[1];

          transform: rotate[-90deg] scaleX[1];

}

progress {

  -webkit-appearance: none;

  -moz-appearance: none;

  appearance: none;

  background: transparent;

  color: rgba[255, 255, 255, 0.2];

  border: none;

  height: 8px;

  width: 100%;

}

progress::-webkit-progress-bar {

  background: transparent;

}

progress::-webkit-progress-value {

  background: transparent;

}

.bar-buffer::-webkit-progress-value {

  background: rgba[255, 255, 255, 0.2];

}

.bar-buffer::-moz-progress-bar {

  background: rgba[255, 255, 255, 0.2];

}

.bar-progress::-webkit-progress-value {

  background: #ff3c3c;

}

.bar-progress::-moz-progress-bar {

  background: #ff3c3c;

}

.bar-progress {

  color: #ff3c3c;

}

.btn-replay {

  background: none;

  border: none;

  display: none;

  color: #ff3c3c;

  position: absolute;

  top: 50%;

  left: 50%;

  margin-left: -110px;

  margin-top: -110px;

  font-size: 9rem;

  width: 220px;

  height: 220px;

}

.time-bubble {

  background: #61b5d9;

  border-radius: 1.5rem 1.5rem 0px;

  height: 1.5rem;

  line-height: 1.5rem;

  position: absolute;

  bottom: 3.2rem;

  left: 4.8rem;

  padding: 0.5em;

  display: none;

}

.next {

  background: #212121;

  padding: 16.5px;

  max-height: 60px;

}

.next-video {

  display: block;

  height: 140px;

  position: relative;

  overflow: hidden;

}

.next-video img {

  display: block;

}

.next-video::before {

  background: linear-gradient[0deg, rgb[33,33,33, 0.8] 0%, transparent 60%];

  content: "";

  width: 100%;

  height: 100%;

  position: absolute;

  transition: all 0.5s;

}

.single-video-title {

  position: absolute;

  -webkit-transform: translateY[-4.5rem];

          transform: translateY[-4.5rem];

  padding: 0.75rem 1.5rem;

  transition: all 0.5s;

}

.single-video-info {

  box-sizing: border-box;

  font-size: 14px;

  font-weight: 400;

  padding: 0.75rem 1.5rem;

  position: absolute;

  -webkit-transform: translateY[-6.75rem];

          transform: translateY[-6.75rem];

  transition: all 0.5s;

  opacity: 0;

  width: 100%;

}

.next-video:hover .single-video-title {

  -webkit-transform: translateY[-9.75rem];

          transform: translateY[-9.75rem];

}

.next-video:hover::before {

  background: rgb[33,33,33, 0.7];

}

.next-video:hover .single-video-info {

  opacity: 1;

}

.played-video {

  -webkit-transform: scale[0];

          transform: scale[0];

  height: 0;

  width: 0;

}

.info-area {

  background: #fff;

  color: #212121;

}

.info-heading {

  color: #61b5d9;

  font-size: 3rem;

  font-weight: 300;

  text-align: center;

  margin: 4.5rem auto;

}

.clearfix:before, .wrapper:before, .video-header:before, .clearfix:after, .wrapper:after, .video-header:after {

  content: " ";

  display: table;

}

.clearfix:after, .wrapper:after, .video-header:after {

  clear: both;

}

@-webkit-keyframes bottomSlide {

  0% {

    -webkit-transform: translate3d[0, 100%, 0];

            transform: translate3d[0, 100%, 0];

    opacity: 1;

  }

  100% {

    opacity: 1;

  }

}

@keyframes bottomSlide {

  0% {

    -webkit-transform: translate3d[0, 100%, 0];

            transform: translate3d[0, 100%, 0];

    opacity: 1;

  }

  100% {

    opacity: 1;

  }

}

function.js

The final step, Create a JavaScript file named ‘function.js‘ and put the codes.

function.js

/* Code By Webdevtrick [ //webdevtrick.com ] */ var videoPlayer = function[]{ "use strict"; function el[id] { return document.getElementById[id]; } var vid = el["video"], btnState = el["btnState"], btnReplay = el["btnReplay"], btnSound = el["btnSound"], sliderVolume = el["sliderVolume"], barSeeker = el["barSeeker"], barBuffer = el["barBuffer"], barProgress = el["barProgress"], timePlayed = el["timePlayed"], timeDuration = el["timeDuration"], timeBubble = el["timeBubble"], thePosition, theMinutes, theSeconds, theTime; var readableTime = function[t] { theMinutes = "0" + Math.floor[t / 60]; // Divide seconds to get minutes, add leading zero theSeconds = "0" + parseInt[t % 60]; // Get remainder seconds theTime = theMinutes.slice[-2] + ":" + theSeconds.slice[-2]; // Slice to two spots to remove excess zeros return theTime; }; /* Video controls */ var togglePlay = function[]{ if[vid.paused] { vid.play[]; btnState.firstElementChild.className = "fontawesome-pause"; btnReplay.style.display = "none"; vid.style.opacity = 1; } else { vid.pause[]; btnState.firstElementChild.className = "fontawesome-play"; } }; var toggleSound = function[]{ if[vid.muted] { vid.muted = false; sliderVolume.value = 10; btnSound.firstElementChild.className = "fontawesome-volume-up"; } else { vid.muted = true; sliderVolume.value = 0; btnSound.firstElementChild.className = "fontawesome-volume-off"; } }; /* Update seeker value and time played */ var updateTimeDisplay = function[] { var timePercent = [100 / vid.duration] * vid.currentTime; barSeeker.value = timePercent; barProgress.value = timePercent; timePlayed.innerHTML = readableTime[vid.currentTime]; }; var replayVideo = function[] { vid.currentTime = 0; btnState.firstElementChild.className = "fontawesome-pause"; btnReplay.style.display = "none"; vid.play[]; }; // Toggle buttons vid.addEventListener["click",togglePlay]; btnState.addEventListener["click",togglePlay]; btnSound.addEventListener["click",toggleSound]; // Volume slider sliderVolume.addEventListener["change", function[] { var theVolume = sliderVolume.value / 10; vid.volume = theVolume; if[theVolume === 0] { btnSound.firstElementChild.className = "fontawesome-volume-off"; } else if [theVolume === 1] { btnSound.firstElementChild.className = "fontawesome-volume-up"; } else { btnSound.firstElementChild.className = "fontawesome-volume-down"; } }]; // Move seeker bar vid.addEventListener["timeupdate",updateTimeDisplay]; // Allow click on seeker to change video position barSeeker.addEventListener["change", function[] { thePosition = vid.duration * [barSeeker.value / 100]; vid.currentTime = thePosition; }]; // Pause video and seeker update while seeker is being interacted with barSeeker.addEventListener["mousedown",function[]{ vid.pause[]; vid.removeEventListener["timeupdate",updateTimeDisplay]; }]; barSeeker.addEventListener["mouseup",function[]{ vid.play[]; btnState.firstElementChild.className = "fontawesome-pause"; vid.addEventListener["timeupdate",updateTimeDisplay]; }]; // Buffer bar vid.addEventListener["timeupdate", function[] { var bufferPercent = [100 / vid.duration] * vid.buffered.end[vid.buffered.length - 1]; barBuffer.value = bufferPercent; }]; // Video length vid.addEventListener['loadeddata', function[]{ timeDuration.innerHTML = readableTime[vid.duration]; }]; // Time bubble on seeker var bubblePop = function[e]{ var cursorPos = [e.clientX - [barSeeker.getBoundingClientRect[].left]] / [barSeeker.offsetWidth]; var seekTime = cursorPos * vid.duration; if[seekTime] { timeBubble.innerHTML = readableTime[seekTime]; timeBubble.style.left = [e.clientX - barSeeker.getBoundingClientRect[].left + 78] + "px"; timeBubble.style.display = "block"; } }; barSeeker.addEventListener["mousemove", bubblePop]; barSeeker.addEventListener["mouseout", function[]{ timeBubble.style.display = "none"; }]; // Video playlist var playlistAnchor = document.querySelectorAll[".next-video"], imageURL = document.querySelectorAll[".next-video img"]; var prevTitle = document.querySelector[".video-title"], prevDescription = document.querySelector[".description"]; for [var i = 0; i < 4; i++] { [function[]{ var k = i; playlistAnchor[i].addEventListener["click", function[e]{ e.preventDefault[]; var playedVideo = document.querySelector[".played-video"]; playedVideo.classList.remove["slide"]; playedVideo.classList.remove["played-video"]; // Update video vid.poster = imageURL[k].src; vid.src = playlistAnchor[k].href; // Update info prevTitle.innerHTML = this.querySelector[".single-video-title"].textContent; prevDescription.innerHTML = this.querySelector[".single-video-des"].textContent; // Reset and play video replayVideo[]; this.classList.add["played-video"]; playedVideo.classList.add["slide"]; setTimeout[function[]{ playlistAnchor[k].parentNode.appendChild[playlistAnchor[k]]; }, 500]; }]; }[]]; } }[];

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

/* Code By Webdevtrick [ //webdevtrick.com ] */

var videoPlayer = function[]{

    "use strict";

    function el[id] {

        return document.getElementById[id];

    }

    var vid = el["video"],

        btnState = el["btnState"],

        btnReplay = el["btnReplay"],

        btnSound = el["btnSound"],

        sliderVolume = el["sliderVolume"],

        barSeeker = el["barSeeker"],

        barBuffer = el["barBuffer"],

        barProgress = el["barProgress"],

        timePlayed = el["timePlayed"],

        timeDuration = el["timeDuration"],

        timeBubble = el["timeBubble"],

        thePosition,

        theMinutes,

        theSeconds,

        theTime;

    var readableTime = function[t] {

        theMinutes = "0" + Math.floor[t / 60]; // Divide seconds to get minutes, add leading zero

        theSeconds = "0" + parseInt[t % 60]; // Get remainder seconds

        theTime = theMinutes.slice[-2] + ":" + theSeconds.slice[-2]; // Slice to two spots to remove excess zeros

        return theTime;

    };

    /* Video controls */

    var togglePlay = function[]{

        if[vid.paused] {

            vid.play[];

            btnState.firstElementChild.className = "fontawesome-pause";

            btnReplay.style.display = "none";

            vid.style.opacity = 1;

        } else {

            vid.pause[];

            btnState.firstElementChild.className = "fontawesome-play";

        }

    };

    var toggleSound = function[]{

        if[vid.muted] {

            vid.muted = false;

            sliderVolume.value = 10;

            btnSound.firstElementChild.className = "fontawesome-volume-up";

        } else {

            vid.muted = true;

            sliderVolume.value = 0;

            btnSound.firstElementChild.className = "fontawesome-volume-off";

        }

    };

    /* Update seeker value and time played */

    var updateTimeDisplay = function[] {

        var timePercent = [100 / vid.duration] * vid.currentTime;

        barSeeker.value = timePercent;

        barProgress.value = timePercent;

        timePlayed.innerHTML = readableTime[vid.currentTime];

    };

    var replayVideo = function[] {

        vid.currentTime = 0;

        btnState.firstElementChild.className = "fontawesome-pause";

        btnReplay.style.display = "none";

        vid.play[];

    };

    // Toggle buttons

    vid.addEventListener["click",togglePlay];

    btnState.addEventListener["click",togglePlay];

    btnSound.addEventListener["click",toggleSound];

    // Volume slider

    sliderVolume.addEventListener["change", function[] {

        var theVolume = sliderVolume.value / 10;

        vid.volume = theVolume;

        if[theVolume === 0] {

            btnSound.firstElementChild.className = "fontawesome-volume-off";

        } else if [theVolume === 1] {

            btnSound.firstElementChild.className = "fontawesome-volume-up";

        } else {

            btnSound.firstElementChild.className = "fontawesome-volume-down";

        }

    }];

    // Move seeker bar

    vid.addEventListener["timeupdate",updateTimeDisplay];

    // Allow click on seeker to change video position

    barSeeker.addEventListener["change", function[] {

        thePosition = vid.duration * [barSeeker.value / 100];

        vid.currentTime = thePosition;

    }];

    // Pause video and seeker update while seeker is being interacted with

    barSeeker.addEventListener["mousedown",function[]{

        vid.pause[];

        vid.removeEventListener["timeupdate",updateTimeDisplay];

    }];

    barSeeker.addEventListener["mouseup",function[]{

        vid.play[];

        btnState.firstElementChild.className = "fontawesome-pause";

        vid.addEventListener["timeupdate",updateTimeDisplay];

    }];

    // Buffer bar

    vid.addEventListener["timeupdate", function[] {

        var bufferPercent = [100 / vid.duration] * vid.buffered.end[vid.buffered.length - 1];

        barBuffer.value = bufferPercent;

    }];

    // Video length

    vid.addEventListener['loadeddata', function[]{

        timeDuration.innerHTML = readableTime[vid.duration];

    }];

    // Time bubble on seeker

    var bubblePop = function[e]{

        var cursorPos = [e.clientX - [barSeeker.getBoundingClientRect[].left]] / [barSeeker.offsetWidth];

        var seekTime = cursorPos * vid.duration;

        if[seekTime] {

            timeBubble.innerHTML = readableTime[seekTime];

            timeBubble.style.left = [e.clientX - barSeeker.getBoundingClientRect[].left + 78] + "px";

            timeBubble.style.display = "block";

        }

    };

    barSeeker.addEventListener["mousemove", bubblePop];

    barSeeker.addEventListener["mouseout", function[]{

        timeBubble.style.display = "none";

    }];

// Video playlist

var playlistAnchor = document.querySelectorAll[".next-video"],

    imageURL = document.querySelectorAll[".next-video img"];

var prevTitle = document.querySelector[".video-title"],

    prevDescription = document.querySelector[".description"];

    for [var i = 0; i

Chủ Đề