|
|
|
|
@ -1,113 +1,7 @@
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en" ng-app="StarterApp">
|
|
|
|
|
<html lang="en" ng-app="MpvRemoteApp">
|
|
|
|
|
<head>
|
|
|
|
|
<title>mpv remote</title>
|
|
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
md-content {
|
|
|
|
|
background-color: #eee;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
md-card {
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
md-card h2:first-of-type {
|
|
|
|
|
margin-top: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.md-toolbar-tools-bottom {
|
|
|
|
|
font-size: small;
|
|
|
|
|
}
|
|
|
|
|
.md-toolbar-tools-bottom :last-child {
|
|
|
|
|
opacity: 0.8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#status {
|
|
|
|
|
color: #c60008;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* The starting CSS styles for the enter animation */
|
|
|
|
|
.fade.ng-enter {
|
|
|
|
|
transition:0.5s linear all;
|
|
|
|
|
opacity:0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The finishing CSS styles for the enter animation */
|
|
|
|
|
.fade.ng-enter.ng-enter-active {
|
|
|
|
|
opacity:1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* now the element will fade out before it is removed from the DOM */
|
|
|
|
|
.fade.ng-leave {
|
|
|
|
|
transition:0.5s linear all;
|
|
|
|
|
opacity:1;
|
|
|
|
|
}
|
|
|
|
|
.fade.ng-leave.ng-leave-active {
|
|
|
|
|
opacity:0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
section {
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin: 0.5em;
|
|
|
|
|
position: relative !important;
|
|
|
|
|
padding-bottom: 5px; }
|
|
|
|
|
|
|
|
|
|
section .md-button {
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
margin-bottom: 1px; }
|
|
|
|
|
|
|
|
|
|
.label {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 10px;
|
|
|
|
|
left: 10px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
opacity: 0.84; }
|
|
|
|
|
|
|
|
|
|
.status-container {
|
|
|
|
|
height: 50px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dont-break-out {
|
|
|
|
|
|
|
|
|
|
/* These are technically the same, but use both */
|
|
|
|
|
overflow-wrap: break-word;
|
|
|
|
|
word-wrap: break-word;
|
|
|
|
|
|
|
|
|
|
-ms-word-break: break-all;
|
|
|
|
|
/* This is the dangerous one in WebKit, as it breaks things wherever */
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
/* Instead use this non-standard one: */
|
|
|
|
|
word-break: break-word;
|
|
|
|
|
|
|
|
|
|
/* Adds a hyphen where the word breaks, if supported (No Blink) */
|
|
|
|
|
-ms-hyphens: auto;
|
|
|
|
|
-moz-hyphens: auto;
|
|
|
|
|
-webkit-hyphens: auto;
|
|
|
|
|
hyphens: auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.overlay {
|
|
|
|
|
height: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
position: fixed;
|
|
|
|
|
z-index: 1000;
|
|
|
|
|
left: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
background-color: rgb(0,0,0);
|
|
|
|
|
background-color: rgba(0,0,0, 0.5);
|
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
transition: 0.5s;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
|
<meta name="description" content="">
|
|
|
|
|
@ -115,20 +9,17 @@ height: 50px;
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,500,700,400italic">
|
|
|
|
|
<link rel="stylesheet" href="../node_modules/angular-material/angular-material.css"/>
|
|
|
|
|
<link rel="stylesheet" href="style.css"/>
|
|
|
|
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
|
|
|
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body layout="row" ng-controller="MpvRemote">
|
|
|
|
|
<div id="overlay" class="overlay">
|
|
|
|
|
</div>
|
|
|
|
|
<div id="overlay" class="overlay"></div>
|
|
|
|
|
|
|
|
|
|
<div layout="column" class="relative" layout-fill role="main">
|
|
|
|
|
<md-toolbar>
|
|
|
|
|
<div class="md-toolbar-tools">
|
|
|
|
|
<h3>
|
|
|
|
|
mpv remote
|
|
|
|
|
</h3>
|
|
|
|
|
<h3>mpv remote</h3>
|
|
|
|
|
<md-chips><md-chip>{{connectionStatus}}</md-chip></md-chips>
|
|
|
|
|
<span flex></span>
|
|
|
|
|
<md-button aria-label="Open Settings" ng-click="showListBottomSheet($event)">
|
|
|
|
|
@ -147,9 +38,9 @@ height: 50px;
|
|
|
|
|
<md-icon class="material-icons" ng-hide="isPlaying" ng-click="play()">play_arrow</md-icon>
|
|
|
|
|
<md-icon class="material-icons" ng-show="isPlaying" ng-click="pause()">pause</md-icon>
|
|
|
|
|
</md-button>
|
|
|
|
|
<md-slider flex="" min="0" ng-change="onDurationChange()" max="{{totalDurationSeconds}}" ng-model="currentDurationSeconds" aria-label="Progress" id="progress-slider">
|
|
|
|
|
</md-slider>
|
|
|
|
|
<md-slider flex="" min="0" ng-change="onDurationChange()" max="{{totalDurationSeconds}}" ng-model="currentDurationSeconds" aria-label="Progress" id="progress-slider"></md-slider>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<label layout="column" layout-align="center center">{{currentDurationSeconds | toMinSec}}/{{totalDurationSeconds | toMinSec}}</label>
|
|
|
|
|
|
|
|
|
|
<section layout="row" layout-sm="column" layout-align="center center" layout-wrap>
|
|
|
|
|
@ -157,7 +48,6 @@ height: 50px;
|
|
|
|
|
<md-button class="md-fab" aria-label="Back" ng-click="back()">
|
|
|
|
|
<md-icon class="material-icons">fast_rewind</md-icon>
|
|
|
|
|
</md-button>
|
|
|
|
|
|
|
|
|
|
<md-button class="md-fab" aria-label="Forward" ng-click="forward()">
|
|
|
|
|
<md-icon class="material-icons">fast_forward</md-icon>
|
|
|
|
|
</md-button>
|
|
|
|
|
@ -173,7 +63,6 @@ height: 50px;
|
|
|
|
|
</md-button>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section layout="row" layout-sm="column" layout-align="center center" layout-wrap>
|
|
|
|
|
<md-button ng-show="isMuted" class="md-fab" aria-label="Unmute" ng-click="unmute()">
|
|
|
|
|
<md-icon class="material-icons">volume_mute</md-icon>
|
|
|
|
|
@ -189,16 +78,8 @@ height: 50px;
|
|
|
|
|
<md-button class="md-fab" aria-label="Volume up" ng-click="volumeUp()">
|
|
|
|
|
<md-icon class="material-icons">volume_up</md-icon>
|
|
|
|
|
</md-button>
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<div class="status-container">
|
|
|
|
|
<div class="ng-scope fade" ng-if="status" id="status">
|
|
|
|
|
<b layout="row" layout-align="center center" class="md-padding ng-binding layout-align-center-center layout-row">
|
|
|
|
|
{{status}}
|
|
|
|
|
</b>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</ui-view>
|
|
|
|
|
</md-content>
|
|
|
|
|
</div>
|
|
|
|
|
@ -212,14 +93,14 @@ height: 50px;
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
|
|
function openOverlay() {
|
|
|
|
|
document.getElementById('overlay').style.height = "100%";
|
|
|
|
|
document.getElementById('overlay').style.height = '100%';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function closeOverlay() {
|
|
|
|
|
document.getElementById('overlay').style.height = "0%";
|
|
|
|
|
document.getElementById('overlay').style.height = '0%';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var app = angular.module('StarterApp', ['ngMaterial', 'ngMdIcons']);
|
|
|
|
|
var app = angular.module('MpvRemoteApp', ['ngMaterial', 'ngMdIcons']);
|
|
|
|
|
app.filter('toMinSec', function(){
|
|
|
|
|
return function(input){
|
|
|
|
|
var minutes = parseInt(input/60, 10);
|
|
|
|
|
@ -232,31 +113,16 @@ app.filter('toMinSec', function(){
|
|
|
|
|
})
|
|
|
|
|
app.controller('MpvRemote', ['$scope', '$mdBottomSheet', '$http', '$timeout', function($scope, $mdBottomSheet, $http, $timeout){
|
|
|
|
|
|
|
|
|
|
// functions
|
|
|
|
|
var showStatus = function(text) {
|
|
|
|
|
$scope.status = text;
|
|
|
|
|
$timeout(function() {$scope.status = ''; }, 2000);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Commands
|
|
|
|
|
var seekCommand = function(targetDuration) {
|
|
|
|
|
return {
|
|
|
|
|
command: 'seek',
|
|
|
|
|
seekValue: targetDuration
|
|
|
|
|
};
|
|
|
|
|
return { command: 'seek', seekValue: targetDuration };
|
|
|
|
|
};
|
|
|
|
|
var changeVolumeCommand = function(targetVolume) {
|
|
|
|
|
return {
|
|
|
|
|
command: 'changeVolume',
|
|
|
|
|
seekValue: targetDuration
|
|
|
|
|
};
|
|
|
|
|
return { command: 'changeVolume', seekValue: targetVolume };
|
|
|
|
|
};
|
|
|
|
|
var chapterCommand = function(isForward) {
|
|
|
|
|
var direction = isForward ? 'forward' : 'backward';
|
|
|
|
|
return {
|
|
|
|
|
command: 'seekChapter',
|
|
|
|
|
direction: direction
|
|
|
|
|
};
|
|
|
|
|
return { command: 'seekChapter', direction: direction };
|
|
|
|
|
};
|
|
|
|
|
var playCommand = { command: 'play' };
|
|
|
|
|
var pauseCommand = { command: 'pause' };
|
|
|
|
|
@ -274,7 +140,6 @@ $scope.connectionStatus = '';
|
|
|
|
|
$scope.alert = '';
|
|
|
|
|
|
|
|
|
|
// Socket stuff
|
|
|
|
|
//var socket = new WebSocket('ws://echo.websocket.org');
|
|
|
|
|
var socket;
|
|
|
|
|
var connect = function() {
|
|
|
|
|
socket = new WebSocket('ws://192.168.1.42:8000');
|
|
|
|
|
@ -324,17 +189,16 @@ $scope.onDurationChange = function() {
|
|
|
|
|
sendCommand(seekCommand($scope.currentDurationSeconds));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.onVolumeChange = function() {
|
|
|
|
|
console.log($scope.currentVolume);
|
|
|
|
|
sendCommand(changeVolumeCommand($scope.currentVolume));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.previousChapter = function() { sendCommand(chapterCommand(false)) };
|
|
|
|
|
$scope.nextChapter = function() { sendCommand(chapterCommand(true)) };
|
|
|
|
|
$scope.back = function() { sendCommand(seekCommand(Math.max(0, $scope.currentDurationSeconds - 10))) };
|
|
|
|
|
$scope.play = function() {
|
|
|
|
|
$scope.isPlaying = true;
|
|
|
|
|
sendCommand(playCommand);
|
|
|
|
|
};
|
|
|
|
|
$scope.pause = function() {
|
|
|
|
|
$scope.isPlaying = false;
|
|
|
|
|
sendCommand(pauseCommand);
|
|
|
|
|
};
|
|
|
|
|
$scope.play = function() { sendCommand(playCommand) };
|
|
|
|
|
$scope.pause = function() { sendCommand(pauseCommand) };
|
|
|
|
|
$scope.forward = function() { sendCommand(seekCommand(Math.min($scope.totalDurationSeconds, $scope.currentDurationSeconds + 10))) };
|
|
|
|
|
$scope.volumeUp = function() { volume(5) };
|
|
|
|
|
$scope.volumeDown = function() { volume(-5) };
|
|
|
|
|
|