A full screen slide show for images and videos

Overview

Vanilla JS Slide full screen slide show for videos and images

Why?

This is a scratch-your-own-itch project as I wanted a way to see images and videos full screen in my browser that loop.

Preview and Quicklook on MacOS are awesome but their treatment of GIFs and the inability for Quicklook to loop videos annoyed me, so I wrote this. You can see it in action in this YouTube Video

Slide show showing a picture of a dog with a lot of tennis balls

Features

  • Displays any video or image in a folder in the largest possible size without cropping
  • Mouse or keyboard navigation (Arrow Left and right for back and forward, Space to toggle automatic advancing)
  • Slide show option showing a new image every x seconds.
  • Slide show waits for images to load and videos to be playable before advancing
  • Stores the current position of the slide show. Next time you load the document it commences where it stopped last time.

Usage

You can use the slideshow by giving it a container to create all the elements in, define the different settings of the slideshow object:

  • container: a DOM reference to the HTML element the slide show should be added in
  • media: an Array of images and videos to display
  • folder: the folder containing these - this should be a child folder of one the slide show is in.
  • autoplay: yes or no indicating if the slide show should start or not
  • speed: time in milliseconds to advance to the next media item (f.e. 1000 for a second)
  • endless: yes or no indicating if hitting next on the last element should go to the first and back on the first element to the last one.
<div id="slideshow-container"></div>
<script>
  let slideshow = {
    container: '#slideshow-container',
    media: [
    'ball.mp4','dinowalk.mp4','dirty.mp4',
    'goldiejump.mp4','step.mp4','tippy.mp4','wag.mp4'
    ],
    folder: 'imgs/',
    autoplay: 'yes'
  }
</script>
<script src="slideshow.js"></script>

Automating the media collection

Currently I am using this on my hard drive running a local server and the index.php script. If you are using a Mac, PHP comes with the system. Go to the terminal, navigate to the folder where the slide show is and run:

$ php -S localhost:8000

Then you can navigate in you browser to localhost:8000 and the rest happens automatically.

The index.php script lists all the current folders in the directory the script is in and gives you list of all of them. Clicking the link of the name starts the slide show with the current folder. Feel free to check the script, but there isn't much magic there.

Comments
  • It would be safer to use .innerText instead of .innerHTML when it's possible

    It would be safer to use .innerText instead of .innerHTML when it's possible

    .innerHTML usage usually raises warnings from code security scanners.

    It might indeed be a security issue if you let anybody provide the slideshow URLs.

    It's possible to replace by .innerText everywhere in slideshow.js, except line 6, where it's actually (static) HTML that is inserted.

    I can make a PR for that.

    And this last usage of .innerHTML might be replaced by javascript code, too (but I did not do it)

    opened by mossroy 0
  • If the image URL returns an HTTP error code, it does not go the next one

    If the image URL returns an HTTP error code, it does not go the next one

    A new i Image object is created, and it's necessary that loaded() is called for the next image/video to be loaded.

    But loaded() is only called in i.onload function, and there is no i.onerror function

    I managed to solve that by adding an i.onerror function, that display an error message in the wrapper, and calls loaded()

    I can make a PR if you want

    opened by mossroy 0
  • In some cases, a video frame can stay on top of next image

    In some cases, a video frame can stay on top of next image

    This happened to me only on in the following case:

    • Firefox browser (the problem does not happen on Chromium-based browsers)
    • a video is followed by an image
    • the video is short enough to be played several times before switching to the image

    In this case, a frame of the video appears in front of the image.

    It seems to come from the eventlistener "canplaythrough" that is called each time the video is (re)-started, instead of only once. I managed to solve that by passing once: true after passive: true to the addEventListener call

    I can make a PR if you want

    opened by mossroy 0
  • Video play duration

    Video play duration

    Video slideshow with several mp4 videos change exactly after 3000 ms to the next video. For me it would make more sense to skip the slideshow.speed on videos and use the video duration instead.

    opened by zimmerlis 1
  • Videos only play when I interact with the slideshow

    Videos only play when I interact with the slideshow

    Hi! This is really good, thanks for it... I can't get the videos to autoplay. It only plays when I interact with the buttons, otherwise it's paused in the first frame. Do you know a way to autoplay videos as the slideshow goes, without having to interact with it?

    opened by masilli 1
Owner
Christian Heilmann
Senior Program manager for Microsoft working on Edge and anything JavaScript related. AI/ML fanboy. Not here for a new job.
Christian Heilmann
A simple library to view large images up close using simple mouse interaction, and the full screen.

Intense Images A stand alone javascript library for viewing images on the full, full screen. Using the touch/mouse position for panning. Here's a demo

Tim Holman 2.6k Dec 31, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
App that allows you to control and watch YouTube videos using hand gestures. Additionally, app that allows you to search for videos, playlists, and channels.

YouTube Alternative Interaction App An app I made with Edward Wu that allows you to search and watch videos from YouTube. Leverages Google's YouTube D

Aaron Lam 2 Dec 28, 2021
As babies smash on the keyboard, images, letters and numbers appear on the screen

Baby Bam Bam As babies smash on the keyboard, images, letters and numbers appear on the screen. Try the many options and find the ones that are right

Boris Fritscher 3 Oct 24, 2022
Asciifly is a webapp where you can asciify images and youtube videos on the fly.

Asciifly Asciifly is a webapp where you can asciify images and youtube videos on the fly. Come visit at https://asciifly.com Hosting I'm hosting this

André Esser 7 May 23, 2022
A Simple yet extendable jQuery modal script built for use with inline HTML, images, videos, and galleries.

jQuery Chaos Modal A Simple yet extendable jQuery modal script built for use with inline HTML, forms, and images in mind. There are many other modal p

Matthew Sigley 3 Oct 8, 2020
TVMAZE API-based webapp, receives TV show episodes with all data about that TV show.

TVMAZE API-based webapp, receives TV show episodes with all data about that TV show. The Webapp has two interfaces: A home page, showing a list of Tv show episodes you can like. And a popup window with more data about the TV show that you can comment on.

Yasin Warsame 4 Aug 9, 2022
Make use of your favicon with badges, images or videos

favico.js More info here. Author Miroslav Magda Version 0.3.9 Contributors: Serge Barysiuk, pissflaps, Yaroslav Yakovlev, LoicMahieu, Renan Gonçalves,

Miroslav Magda 8.7k Dec 21, 2022
A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more

Glide.js is a dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more What can co

null 6.7k Jan 3, 2023
Simple customizable slide panel (without jQuery)

toolslide.js Minimalistic customizable slide panel (without jQuery) Table of contents Quick start Usage Examples Options Methods Events Browser suppor

null 5 May 23, 2022
A markdown based tool for slide deck creation.

Decker A markdown based tool for slide deck creation. Installation from source Install stack and Node.js (for npm) Clone this repo. cd decker git subm

Decker 8 Nov 7, 2022
Slide everything into this vanilla javascript slider: just 20kb all-inclusive, no dependencies!

Lightweight vanilla javascript media and contents slider, by LCweb Just 20KB to have: Top features list: single file, no dependencies, 100% pure javas

Luca 4 May 12, 2021
A vanilla js library to show preview images on hover

Hover Preview A vanilla js library to show preview images on hover, check a Demo here Please watch ?? or star ?? this repo if you like it. Getting sta

Atul Yadav 7 Dec 13, 2021
Easiest 1-click way to install and use Stable Diffusion on your own computer. Provides a browser UI for generating images from text prompts and images. Just enter your text prompt, and see the generated image.

Stable Diffusion UI Easiest way to install and use Stable Diffusion on your own computer. No dependencies or technical knowledge required. 1-click ins

null 3.5k Dec 30, 2022
MidJourney is an AI text-to-image service that generates images based on textual prompts. It is often used to create artistic or imaginative images, and is available on Discord and through a web interface here.

Midjourney MidJourney is an AI text-to-image service that generates images based on textual prompts. It is often used to create artistic or imaginativ

Andrew Tsegaye 8 May 1, 2023