Commit 9e711784 authored by Gautam Chitnis's avatar Gautam Chitnis

Feature (repeat, delete): added the functionality to toggle repeat and perform delete

This commit has added the functionality to toggle repeat function for currently playing video.
It has also added the functionality to delete current playing item from playlist and refresh the playlist in browser to show changes.

Gautam C.
parent 8e71167d
......@@ -59,10 +59,10 @@
<div class="playlistIcons">
<div class="row">
<button type="button" class="btn-circle col-xs"><i class="glyphicon glyphicon-random"></i></button>
<button type="button" class="btn-circle col-xs"><i class="glyphicon glyphicon-repeat"></i></button>
<button type="button" class="btn-circle col-xs" onclick="toggleRepeat()"><i class="glyphicon glyphicon-repeat"></i></button>
<button type="button" class="btn-circle col-xs"><i class="glyphicon glyphicon-play-circle"></i></button>
<button type="button" class="btn-circle col-xs"><i class="glyphicon glyphicon-plus"></i></button>
<button type="button" class="btn-circle col-xs"><i class="glyphicon glyphicon-trash"></i></button>
<button type="button" class="btn-circle col-xs" onclick="removeCurrent()"><i class="glyphicon glyphicon-trash"></i></button>
</div>
</div>
<div class="d-flex justify-content-center">
......
......@@ -14,14 +14,18 @@ function plyrInit()
var cmd = "command=volume&val="+event.detail.plyr.getVolume()*255;
sendCommand(0,cmd);
});
player[0].on('loadstart', function(event) {
sendCommand(0,"command=pl_play&id="+id);
});
}
function setVideo(videoSrc, type, id)
{
sendCommand(0,"command=pl_play&id="+id);
player[0].source({
type: 'video',
title: 'Example title',
title: '',
sources: [{
src: videoSrc,
type: type
......
var player;
var app;
var fileInput;
var jsonData
var jsonData;
var data;
window.onload = function() {
plyrInit();
......@@ -29,12 +30,24 @@ function playlistInit()
function populatePlaylist()
{
var data = JSON.parse(jsonData);
data = JSON.parse(jsonData);
for (var i = 0; i < data.children[0].children.length; i++) {
app.addItem(data.children[0].children[i].id, data.children[0].children[i].name, data.children[0].children[i].src);
}
}
function toggleRepeat()
{
sendCommand(0,"command=pl_repeat");
}
function removeCurrent()
{
sendCommand(0,"command=pl_delete&id="+data.children[0].children[0].id);
app.removeItem(data.children[0].children[0].id);
playlistInit();
}
function sendCommand(mode, params) {
if(mode == 0)
{
......
......@@ -23,6 +23,10 @@ function vueInit()
{
//console.log(playlist);
this.playlist.push({ id: id, title: title, src: src });
},
removeItem: function(id)
{
this.playlist.splice({ id: id });
}
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment