The Open Event Web App has two components :
- An event website generator
- The actual generated website output.
The web generator application can generate event websites by getting data from event JSON files and binary media files, that are stored in a compressed zip file or through an API endpoint. The JSON data format of version 1 as well as version 2, provides user an option to add the slide and video URLs of the sessions. The data from JSONs is extracted and stored in the objects for a particular session, and in the template, the data for videos and slides are rendered in their corresponding iframes.
Extracting data from event JSONs
The data is extracted from the JSONs and is stored in an object. The object containing the data is sent to the procedure which compiles the handlebars templates with that data.
JSON data format v1
video: session.video, slides: session.slides, audio: session.audio
JSON data format v2
video: session['video-url'], slides: session['slides-url'], Audio: session['audio-url']
The JSON data format for v1 and v2 are different and thus the data is extracted from the file depending on API version chosen for web app generation. The files where data extraction takes place are fold_v1.js and fold_v2.js for API v1 and v2 respectively.
Adding event emitter
Onclick event emitter on schedule division calls the procedure “loadVideoAndSlides” with the parameters corresponding to the session clicked.
<div class="schedule-track" id="{{session_id}}" onclick = "loadVideoAndSlides('{{session_id}}', '{{video}}', '{{slides}}')"> ..... ..... </div>
The parameters Session ID, Video URL and Slide URL are passed to the procedure which is responsible for displaying the slides and video iframes for the sessions. This resolves the problem of heavy data binding to the page, as the frames for videos and slides are loaded on page only when the session is clicked.
Procedure called on click event
The performance of web app is significantly improved by using the call and listen mechanism as only the requested videos are loaded into the document object model.
function loadVideoAndSlides(div, videoURL, slideURL){ if(videoURL !== null && videoURL !== '') { $('#desc-' + div).children('div').prepend(' + div + '" class = "video-iframe col-xs-12 col-sm-12 col-md-12" src="https://www.youtube.com/embed/' + videoURL + '" frameborder="0" allowfullscreen>'); } if(slideURL !== null && slideURL !== '') { $('#desc-' + div).children('div').prepend(' + div + '" class = "iframe col-xs-12 col-sm-12 col-md-12" frameborder="0" src="https://view.officeapps.live.com/op/embed.aspx?src=' + slideURL +'">'); } }
The video and slide URLs passed to the procedure are used for loading the iframes from youtube and office apps or google docs respectively as shown above, and the resulting slide view is as shown below
Resources
- Open Event Webapp Repository: https://github.com/fossasia/open-event-webapp
- Pull Requests: https://github.com/fossasia/open-event-webapp/pull/1866, https://github.com/fossasia/open-event-webapp/pull/1878
- Issues : https://github.com/fossasia/open-event-webapp/issues/1809, https://github.com/fossasia/open-event-webapp/issues/1810