mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #117 from sparky8251/volume-slider-fix
Fix volume slider behavior
This commit is contained in:
commit
fccf42274a
4 changed files with 2063 additions and 550 deletions
575
.gitignore
vendored
Normal file
575
.gitignore
vendored
Normal file
|
@ -0,0 +1,575 @@
|
||||||
|
|
||||||
|
# Created by https://www.gitignore.io/api/node,rider,macos,linux,windows,visualstudio,visualstudiocode
|
||||||
|
# Edit at https://www.gitignore.io/?templates=node,rider,macos,linux,windows,visualstudio,visualstudiocode
|
||||||
|
|
||||||
|
### Linux ###
|
||||||
|
*~
|
||||||
|
|
||||||
|
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||||
|
.fuse_hidden*
|
||||||
|
|
||||||
|
# KDE directory preferences
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Linux trash folder which might appear on any partition or disk
|
||||||
|
.Trash-*
|
||||||
|
|
||||||
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
|
.nfs*
|
||||||
|
|
||||||
|
### macOS ###
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
### Node ###
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
### Rider ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# Gradle and Maven with auto-import
|
||||||
|
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||||
|
# since they will be recreated, and may cause churn. Uncomment if using
|
||||||
|
# auto-import.
|
||||||
|
# .idea/modules.xml
|
||||||
|
# .idea/*.iml
|
||||||
|
# .idea/modules
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# File-based project format
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
# Android studio 3.1+ serialized cache file
|
||||||
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
|
### VisualStudioCode ###
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
|
||||||
|
### VisualStudioCode Patch ###
|
||||||
|
# Ignore all local history of files
|
||||||
|
.history
|
||||||
|
|
||||||
|
### Windows ###
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
[Dd]esktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
### VisualStudio ###
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUNIT
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true
|
||||||
|
**/wwwroot/lib/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- Backup*.rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# End of https://www.gitignore.io/api/node,rider,macos,linux,windows,visualstudio,visualstudiocode
|
|
@ -186,13 +186,15 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
volumeSliderContainer.classList.remove('hide');
|
volumeSliderContainer.classList.remove('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
volumeSlider.addEventListener('change', function () {
|
function setVolume() {
|
||||||
|
|
||||||
if (currentPlayer) {
|
if (currentPlayer) {
|
||||||
currentPlayer.setVolume(this.value);
|
currentPlayer.setVolume(this.value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
volumeSlider.addEventListener('change', setVolume.bind(this));
|
||||||
|
volumeSlider.addEventListener('mousemove', setVolume.bind(this));
|
||||||
|
volumeSlider.addEventListener('touchmove', setVolume.bind(this));
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
positionSlider = elem.querySelector('.nowPlayingBarPositionSlider');
|
positionSlider = elem.querySelector('.nowPlayingBarPositionSlider');
|
||||||
positionSlider.addEventListener('change', function () {
|
positionSlider.addEventListener('change', function () {
|
||||||
|
@ -392,6 +394,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
|
|
||||||
var showMuteButton = true;
|
var showMuteButton = true;
|
||||||
var showVolumeSlider = true;
|
var showVolumeSlider = true;
|
||||||
|
var progressElement = volumeSliderContainer.querySelector('.mdl-slider-background-lower');
|
||||||
|
|
||||||
if (supportedCommands.indexOf('ToggleMute') === -1) {
|
if (supportedCommands.indexOf('ToggleMute') === -1) {
|
||||||
showMuteButton = false;
|
showMuteButton = false;
|
||||||
|
@ -403,6 +406,10 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
muteButton.querySelector('i').innerHTML = '';
|
muteButton.querySelector('i').innerHTML = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (progressElement) {
|
||||||
|
progressElement.style.width = (volumeLevel || 0) + '%';
|
||||||
|
}
|
||||||
|
|
||||||
if (supportedCommands.indexOf('SetVolume') === -1) {
|
if (supportedCommands.indexOf('SetVolume') === -1) {
|
||||||
showVolumeSlider = false;
|
showVolumeSlider = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,268 +1,479 @@
|
||||||
define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageLoader", "playbackManager", "nowPlayingHelper", "events", "connectionManager", "apphost", "globalize", "cardStyle", "emby-itemscontainer", "css!css/nowplaying.css", "emby-ratingbutton"], function(browser, datetime, backdrop, libraryBrowser, listView, imageLoader, playbackManager, nowPlayingHelper, events, connectionManager, appHost, globalize) {
|
define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageLoader", "playbackManager", "nowPlayingHelper", "events", "connectionManager", "apphost", "globalize", "cardStyle", "emby-itemscontainer", "css!css/nowplaying.css", "emby-ratingbutton"], function (browser, datetime, backdrop, libraryBrowser, listView, imageLoader, playbackManager, nowPlayingHelper, events, connectionManager, appHost, globalize) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function showAudioMenu(context, player, button, item) {
|
function showAudioMenu(context, player, button, item) {
|
||||||
var currentIndex = playbackManager.getAudioStreamIndex(player),
|
var currentIndex = playbackManager.getAudioStreamIndex(player);
|
||||||
streams = playbackManager.audioTracks(player),
|
var streams = playbackManager.audioTracks(player);
|
||||||
menuItems = streams.map(function(s) {
|
var menuItems = streams.map(function (s) {
|
||||||
var menuItem = {
|
var menuItem = {
|
||||||
name: s.DisplayTitle,
|
name: s.DisplayTitle,
|
||||||
id: s.Index
|
id: s.Index
|
||||||
};
|
};
|
||||||
return s.Index == currentIndex && (menuItem.selected = !0), menuItem
|
|
||||||
|
if (s.Index == currentIndex) {
|
||||||
|
menuItem.selected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return menuItem;
|
||||||
});
|
});
|
||||||
require(["actionsheet"], function(actionsheet) {
|
|
||||||
|
require(["actionsheet"], function (actionsheet) {
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: button,
|
positionTo: button,
|
||||||
callback: function(id) {
|
callback: function (id) {
|
||||||
playbackManager.setAudioStreamIndex(parseInt(id), player)
|
playbackManager.setAudioStreamIndex(parseInt(id), player);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSubtitleMenu(context, player, button, item) {
|
function showSubtitleMenu(context, player, button, item) {
|
||||||
var currentIndex = playbackManager.getSubtitleStreamIndex(player),
|
var currentIndex = playbackManager.getSubtitleStreamIndex(player);
|
||||||
streams = playbackManager.subtitleTracks(player),
|
var streams = playbackManager.subtitleTracks(player);
|
||||||
menuItems = streams.map(function(s) {
|
var menuItems = streams.map(function (s) {
|
||||||
var menuItem = {
|
var menuItem = {
|
||||||
name: s.DisplayTitle,
|
name: s.DisplayTitle,
|
||||||
id: s.Index
|
id: s.Index
|
||||||
};
|
};
|
||||||
return s.Index == currentIndex && (menuItem.selected = !0), menuItem
|
|
||||||
|
if (s.Index == currentIndex) {
|
||||||
|
menuItem.selected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return menuItem;
|
||||||
});
|
});
|
||||||
menuItems.unshift({
|
menuItems.unshift({
|
||||||
id: -1,
|
id: -1,
|
||||||
name: globalize.translate("ButtonOff"),
|
name: globalize.translate("ButtonOff"),
|
||||||
selected: null == currentIndex
|
selected: null == currentIndex
|
||||||
}), require(["actionsheet"], function(actionsheet) {
|
});
|
||||||
|
|
||||||
|
require(["actionsheet"], function (actionsheet) {
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: button,
|
positionTo: button,
|
||||||
callback: function(id) {
|
callback: function (id) {
|
||||||
playbackManager.setSubtitleStreamIndex(parseInt(id), player)
|
playbackManager.setSubtitleStreamIndex(parseInt(id), player);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNowPlayingNameHtml(nowPlayingItem, includeNonNameInfo) {
|
function getNowPlayingNameHtml(nowPlayingItem, includeNonNameInfo) {
|
||||||
return nowPlayingHelper.getNowPlayingNames(nowPlayingItem, includeNonNameInfo).map(function(i) {
|
return nowPlayingHelper.getNowPlayingNames(nowPlayingItem, includeNonNameInfo).map(function (i) {
|
||||||
return i.text
|
return i.text;
|
||||||
}).join("<br/>")
|
}).join("<br/>");
|
||||||
}
|
}
|
||||||
|
|
||||||
function seriesImageUrl(item, options) {
|
function seriesImageUrl(item, options) {
|
||||||
if ("Episode" !== item.Type) return null;
|
if ("Episode" !== item.Type) {
|
||||||
if (options = options || {}, options.type = options.type || "Primary", "Primary" === options.type && item.SeriesPrimaryImageTag) return options.tag = item.SeriesPrimaryImageTag, connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
return null;
|
||||||
if ("Thumb" === options.type) {
|
|
||||||
if (item.SeriesThumbImageTag) return options.tag = item.SeriesThumbImageTag, connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
|
||||||
if (item.ParentThumbImageTag) return options.tag = item.ParentThumbImageTag, connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options)
|
|
||||||
}
|
}
|
||||||
return null
|
|
||||||
|
options = options || {};
|
||||||
|
options.type = options.type || "Primary";
|
||||||
|
if ("Primary" === options.type && item.SeriesPrimaryImageTag) {
|
||||||
|
options.tag = item.SeriesPrimaryImageTag;
|
||||||
|
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("Thumb" === options.type) {
|
||||||
|
if (item.SeriesThumbImageTag) {
|
||||||
|
options.tag = item.SeriesThumbImageTag;
|
||||||
|
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.ParentThumbImageTag) {
|
||||||
|
options.tag = item.ParentThumbImageTag;
|
||||||
|
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function imageUrl(item, options) {
|
function imageUrl(item, options) {
|
||||||
return options = options || {}, options.type = options.type || "Primary", item.ImageTags && item.ImageTags[options.type] ? (options.tag = item.ImageTags[options.type], connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options)) : item.AlbumId && item.AlbumPrimaryImageTag ? (options.tag = item.AlbumPrimaryImageTag, connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options)) : null
|
options = options || {};
|
||||||
|
options.type = options.type || "Primary";
|
||||||
|
|
||||||
|
if (item.ImageTags && item.ImageTags[options.type]) {
|
||||||
|
options.tag = item.ImageTags[options.type];
|
||||||
|
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||||
|
options.tag = item.AlbumPrimaryImageTag;
|
||||||
|
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNowPlayingInfo(context, state) {
|
function updateNowPlayingInfo(context, state) {
|
||||||
var item = state.NowPlayingItem,
|
var item = state.NowPlayingItem;
|
||||||
displayName = item ? getNowPlayingNameHtml(item).replace("<br/>", " - ") : "";
|
var displayName = item ? getNowPlayingNameHtml(item).replace("<br/>", " - ") : "";
|
||||||
context.querySelector(".nowPlayingPageTitle").innerHTML = displayName, displayName.length > 0 ? context.querySelector(".nowPlayingPageTitle").classList.remove("hide") : context.querySelector(".nowPlayingPageTitle").classList.add("hide");
|
context.querySelector(".nowPlayingPageTitle").innerHTML = displayName;
|
||||||
|
|
||||||
|
if (displayName.length > 0) {
|
||||||
|
context.querySelector(".nowPlayingPageTitle").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
context.querySelector(".nowPlayingPageTitle").classList.add("hide");
|
||||||
|
}
|
||||||
|
|
||||||
var url = item ? seriesImageUrl(item, {
|
var url = item ? seriesImageUrl(item, {
|
||||||
maxHeight: 300
|
maxHeight: 300
|
||||||
}) || imageUrl(item, {
|
}) || imageUrl(item, {
|
||||||
maxHeight: 300
|
maxHeight: 300
|
||||||
}) : null;
|
}) : null;
|
||||||
if (console.log("updateNowPlayingInfo"), setImageUrl(context, url), item) {
|
|
||||||
|
console.log("updateNowPlayingInfo");
|
||||||
|
setImageUrl(context, url);
|
||||||
|
if (item) {
|
||||||
backdrop.setBackdrops([item]);
|
backdrop.setBackdrops([item]);
|
||||||
var apiClient = connectionManager.getApiClient(item.ServerId);
|
var apiClient = connectionManager.getApiClient(item.ServerId);
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function(fullItem) {
|
apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) {
|
||||||
var userData = fullItem.UserData || {},
|
var userData = fullItem.UserData || {};
|
||||||
likes = null == userData.Likes ? "" : userData.Likes;
|
var likes = null == userData.Likes ? "" : userData.Likes;
|
||||||
context.querySelector(".nowPlayingPageUserDataButtons").innerHTML = '<button is="emby-ratingbutton" type="button" class="listItemButton paper-icon-button-light" data-id="' + fullItem.Id + '" data-serverid="' + fullItem.ServerId + '" data-itemtype="' + fullItem.Type + '" data-likes="' + likes + '" data-isfavorite="' + userData.IsFavorite + '"><i class="md-icon"></i></button>'
|
context.querySelector(".nowPlayingPageUserDataButtons").innerHTML = '<button is="emby-ratingbutton" type="button" class="listItemButton paper-icon-button-light" data-id="' + fullItem.Id + '" data-serverid="' + fullItem.ServerId + '" data-itemtype="' + fullItem.Type + '" data-likes="' + likes + '" data-isfavorite="' + userData.IsFavorite + '"><i class="md-icon"></i></button>';
|
||||||
})
|
});
|
||||||
} else backdrop.clear(), context.querySelector(".nowPlayingPageUserDataButtons").innerHTML = ""
|
} else {
|
||||||
|
backdrop.clear();
|
||||||
|
context.querySelector(".nowPlayingPageUserDataButtons").innerHTML = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setImageUrl(context, url) {
|
function setImageUrl(context, url) {
|
||||||
currentImgUrl = url;
|
currentImgUrl = url;
|
||||||
var imgContainer = context.querySelector(".nowPlayingPageImageContainer");
|
var imgContainer = context.querySelector(".nowPlayingPageImageContainer");
|
||||||
url ? (imgContainer.innerHTML = '<img class="nowPlayingPageImage" src="' + url + '" />', imgContainer.classList.remove("hide")) : (imgContainer.classList.add("hide"), imgContainer.innerHTML = "")
|
|
||||||
|
if (url) {
|
||||||
|
imgContainer.innerHTML = '<img class="nowPlayingPageImage" src="' + url + '" />';
|
||||||
|
imgContainer.classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
imgContainer.classList.add("hide");
|
||||||
|
imgContainer.innerHTML = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function buttonEnabled(btn, enabled) {
|
function buttonEnabled(btn, enabled) {
|
||||||
btn.disabled = !enabled
|
btn.disabled = !enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buttonVisible(btn, enabled) {
|
function buttonVisible(btn, enabled) {
|
||||||
enabled ? btn.classList.remove("hide") : btn.classList.add("hide")
|
if (enabled) {
|
||||||
|
btn.classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
btn.classList.add("hide");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSupportedCommands(context, commands) {
|
function updateSupportedCommands(context, commands) {
|
||||||
for (var all = context.querySelectorAll(".btnCommand"), i = 0, length = all.length; i < length; i++) buttonEnabled(all[i], -1 != commands.indexOf(all[i].getAttribute("data-command")))
|
var all = context.querySelectorAll(".btnCommand");
|
||||||
|
|
||||||
|
for (var i = 0, length = all.length; i < length; i++) {
|
||||||
|
buttonEnabled(all[i], -1 != commands.indexOf(all[i].getAttribute("data-command")));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var currentImgUrl;
|
var currentImgUrl;
|
||||||
return function() {
|
return function () {
|
||||||
function toggleRepeat(player) {
|
function toggleRepeat(player) {
|
||||||
if (player) switch (playbackManager.getRepeatMode(player)) {
|
if (player) {
|
||||||
|
switch (playbackManager.getRepeatMode(player)) {
|
||||||
case "RepeatNone":
|
case "RepeatNone":
|
||||||
playbackManager.setRepeatMode("RepeatAll", player);
|
playbackManager.setRepeatMode("RepeatAll", player);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "RepeatAll":
|
case "RepeatAll":
|
||||||
playbackManager.setRepeatMode("RepeatOne", player);
|
playbackManager.setRepeatMode("RepeatOne", player);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "RepeatOne":
|
case "RepeatOne":
|
||||||
playbackManager.setRepeatMode("RepeatNone", player)
|
playbackManager.setRepeatMode("RepeatNone", player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePlayerState(player, context, state) {
|
function updatePlayerState(player, context, state) {
|
||||||
lastPlayerState = state;
|
lastPlayerState = state;
|
||||||
var item = state.NowPlayingItem,
|
var item = state.NowPlayingItem;
|
||||||
playerInfo = playbackManager.getPlayerInfo(),
|
var playerInfo = playbackManager.getPlayerInfo();
|
||||||
supportedCommands = playerInfo.supportedCommands;
|
var supportedCommands = playerInfo.supportedCommands;
|
||||||
currentPlayerSupportedCommands = supportedCommands;
|
currentPlayerSupportedCommands = supportedCommands;
|
||||||
var playState = state.PlayState || {};
|
var playState = state.PlayState || {};
|
||||||
buttonVisible(context.querySelector(".btnToggleFullscreen"), item && "Video" == item.MediaType && -1 != supportedCommands.indexOf("ToggleFullscreen")), updateAudioTracksDisplay(player, context), updateSubtitleTracksDisplay(player, context), -1 != supportedCommands.indexOf("DisplayMessage") ? context.querySelector(".sendMessageSection").classList.remove("hide") : context.querySelector(".sendMessageSection").classList.add("hide"), -1 != supportedCommands.indexOf("SendString") ? context.querySelector(".sendTextSection").classList.remove("hide") : context.querySelector(".sendTextSection").classList.add("hide"), buttonVisible(context.querySelector(".btnStop"), null != item), buttonVisible(context.querySelector(".btnNextTrack"), null != item), buttonVisible(context.querySelector(".btnPreviousTrack"), null != item), buttonVisible(context.querySelector(".btnRewind"), null != item), buttonVisible(context.querySelector(".btnFastForward"), null != item);
|
buttonVisible(context.querySelector(".btnToggleFullscreen"), item && "Video" == item.MediaType && -1 != supportedCommands.indexOf("ToggleFullscreen"));
|
||||||
|
updateAudioTracksDisplay(player, context);
|
||||||
|
updateSubtitleTracksDisplay(player, context);
|
||||||
|
|
||||||
|
if (-1 != supportedCommands.indexOf("DisplayMessage")) {
|
||||||
|
context.querySelector(".sendMessageSection").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
context.querySelector(".sendMessageSection").classList.add("hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-1 != supportedCommands.indexOf("SendString")) {
|
||||||
|
context.querySelector(".sendTextSection").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
context.querySelector(".sendTextSection").classList.add("hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
buttonVisible(context.querySelector(".btnStop"), null != item);
|
||||||
|
buttonVisible(context.querySelector(".btnNextTrack"), null != item);
|
||||||
|
buttonVisible(context.querySelector(".btnPreviousTrack"), null != item);
|
||||||
|
buttonVisible(context.querySelector(".btnRewind"), null != item);
|
||||||
|
buttonVisible(context.querySelector(".btnFastForward"), null != item);
|
||||||
var positionSlider = context.querySelector(".nowPlayingPositionSlider");
|
var positionSlider = context.querySelector(".nowPlayingPositionSlider");
|
||||||
|
|
||||||
if (positionSlider && !positionSlider.dragging) {
|
if (positionSlider && !positionSlider.dragging) {
|
||||||
positionSlider.disabled = !playState.CanSeek;
|
positionSlider.disabled = !playState.CanSeek;
|
||||||
var isProgressClear = state.MediaSource && null == state.MediaSource.RunTimeTicks;
|
var isProgressClear = state.MediaSource && null == state.MediaSource.RunTimeTicks;
|
||||||
positionSlider.setIsClear(isProgressClear)
|
positionSlider.setIsClear(isProgressClear);
|
||||||
}
|
}
|
||||||
updatePlayPauseState(playState.IsPaused, null != item), updateTimeDisplay(playState.PositionTicks, item ? item.RunTimeTicks : null), updatePlayerVolumeState(context, playState.IsMuted, playState.VolumeLevel), item && "Video" == item.MediaType ? context.classList.remove("hideVideoButtons") : context.classList.add("hideVideoButtons"), updateRepeatModeDisplay(playState.RepeatMode), updateNowPlayingInfo(context, state)
|
|
||||||
|
updatePlayPauseState(playState.IsPaused, null != item);
|
||||||
|
updateTimeDisplay(playState.PositionTicks, item ? item.RunTimeTicks : null);
|
||||||
|
updatePlayerVolumeState(context, playState.IsMuted, playState.VolumeLevel);
|
||||||
|
|
||||||
|
if (item && "Video" == item.MediaType) {
|
||||||
|
context.classList.remove("hideVideoButtons");
|
||||||
|
} else {
|
||||||
|
context.classList.add("hideVideoButtons");
|
||||||
|
}
|
||||||
|
|
||||||
|
updateRepeatModeDisplay(playState.RepeatMode);
|
||||||
|
updateNowPlayingInfo(context, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAudioTracksDisplay(player, context) {
|
function updateAudioTracksDisplay(player, context) {
|
||||||
var supportedCommands = currentPlayerSupportedCommands;
|
var supportedCommands = currentPlayerSupportedCommands;
|
||||||
buttonVisible(context.querySelector(".btnAudioTracks"), playbackManager.audioTracks(player).length > 1 && -1 != supportedCommands.indexOf("SetAudioStreamIndex"))
|
buttonVisible(context.querySelector(".btnAudioTracks"), playbackManager.audioTracks(player).length > 1 && -1 != supportedCommands.indexOf("SetAudioStreamIndex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSubtitleTracksDisplay(player, context) {
|
function updateSubtitleTracksDisplay(player, context) {
|
||||||
var supportedCommands = currentPlayerSupportedCommands;
|
var supportedCommands = currentPlayerSupportedCommands;
|
||||||
buttonVisible(context.querySelector(".btnSubtitles"), playbackManager.subtitleTracks(player).length && -1 != supportedCommands.indexOf("SetSubtitleStreamIndex"))
|
buttonVisible(context.querySelector(".btnSubtitles"), playbackManager.subtitleTracks(player).length && -1 != supportedCommands.indexOf("SetSubtitleStreamIndex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateRepeatModeDisplay(repeatMode) {
|
function updateRepeatModeDisplay(repeatMode) {
|
||||||
var context = dlg,
|
var context = dlg;
|
||||||
toggleRepeatButton = context.querySelector(".repeatToggleButton");
|
var toggleRepeatButton = context.querySelector(".repeatToggleButton");
|
||||||
"RepeatAll" == repeatMode ? (toggleRepeatButton.innerHTML = "<i class='md-icon'>repeat</i>", toggleRepeatButton.classList.add("repeatButton-active")) : "RepeatOne" == repeatMode ? (toggleRepeatButton.innerHTML = "<i class='md-icon'>repeat_one</i>", toggleRepeatButton.classList.add("repeatButton-active")) : (toggleRepeatButton.innerHTML = "<i class='md-icon'>repeat</i>", toggleRepeatButton.classList.remove("repeatButton-active"))
|
|
||||||
|
if ("RepeatAll" == repeatMode) {
|
||||||
|
toggleRepeatButton.innerHTML = "<i class='md-icon'>repeat</i>";
|
||||||
|
toggleRepeatButton.classList.add("repeatButton-active");
|
||||||
|
} else if ("RepeatOne" == repeatMode) {
|
||||||
|
toggleRepeatButton.innerHTML = "<i class='md-icon'>repeat_one</i>";
|
||||||
|
toggleRepeatButton.classList.add("repeatButton-active");
|
||||||
|
} else {
|
||||||
|
toggleRepeatButton.innerHTML = "<i class='md-icon'>repeat</i>";
|
||||||
|
toggleRepeatButton.classList.remove("repeatButton-active");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePlayerVolumeState(context, isMuted, volumeLevel) {
|
function updatePlayerVolumeState(context, isMuted, volumeLevel) {
|
||||||
var view = context,
|
var view = context;
|
||||||
supportedCommands = currentPlayerSupportedCommands,
|
var supportedCommands = currentPlayerSupportedCommands;
|
||||||
showMuteButton = !0,
|
var showMuteButton = true;
|
||||||
showVolumeSlider = !0; - 1 === supportedCommands.indexOf("Mute") && (showMuteButton = !1), -1 === supportedCommands.indexOf("SetVolume") && (showVolumeSlider = !1), currentPlayer.isLocalPlayer && appHost.supports("physicalvolumecontrol") && (showMuteButton = !1, showVolumeSlider = !1), isMuted ? (view.querySelector(".buttonMute").setAttribute("title", globalize.translate("Unmute")), view.querySelector(".buttonMute i").innerHTML = "") : (view.querySelector(".buttonMute").setAttribute("title", globalize.translate("Mute")), view.querySelector(".buttonMute i").innerHTML = ""), showMuteButton ? view.querySelector(".buttonMute").classList.remove("hide") : view.querySelector(".buttonMute").classList.add("hide");
|
var showVolumeSlider = true;
|
||||||
var nowPlayingVolumeSlider = context.querySelector(".nowPlayingVolumeSlider"),
|
var volumeSlider = view.querySelector('.nowPlayingVolumeSliderContainer');
|
||||||
nowPlayingVolumeSliderContainer = context.querySelector(".nowPlayingVolumeSliderContainer");
|
var progressElement = volumeSlider.querySelector('.mdl-slider-background-lower');
|
||||||
nowPlayingVolumeSlider && (showVolumeSlider ? nowPlayingVolumeSliderContainer.classList.remove("hide") : nowPlayingVolumeSliderContainer.classList.add("hide"), nowPlayingVolumeSlider.dragging || (nowPlayingVolumeSlider.value = volumeLevel || 0))
|
|
||||||
|
if (-1 === supportedCommands.indexOf("Mute")) {
|
||||||
|
showMuteButton = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-1 === supportedCommands.indexOf("SetVolume")) {
|
||||||
|
showVolumeSlider = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentPlayer.isLocalPlayer && appHost.supports("physicalvolumecontrol")) {
|
||||||
|
showMuteButton = false;
|
||||||
|
showVolumeSlider = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMuted) {
|
||||||
|
view.querySelector(".buttonMute").setAttribute("title", globalize.translate("Unmute"));
|
||||||
|
view.querySelector(".buttonMute i").innerHTML = "";
|
||||||
|
} else {
|
||||||
|
view.querySelector(".buttonMute").setAttribute("title", globalize.translate("Mute"));
|
||||||
|
view.querySelector(".buttonMute i").innerHTML = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (progressElement) {
|
||||||
|
progressElement.style.width = (volumeLevel || 0) + '%';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showMuteButton) {
|
||||||
|
view.querySelector(".buttonMute").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
view.querySelector(".buttonMute").classList.add("hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
var nowPlayingVolumeSlider = context.querySelector(".nowPlayingVolumeSlider");
|
||||||
|
var nowPlayingVolumeSliderContainer = context.querySelector(".nowPlayingVolumeSliderContainer");
|
||||||
|
|
||||||
|
if (nowPlayingVolumeSlider) {
|
||||||
|
if (showVolumeSlider) {
|
||||||
|
nowPlayingVolumeSliderContainer.classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
nowPlayingVolumeSliderContainer.classList.add("hide");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nowPlayingVolumeSlider.dragging) {
|
||||||
|
nowPlayingVolumeSlider.value = volumeLevel || 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePlayPauseState(isPaused, isActive) {
|
function updatePlayPauseState(isPaused, isActive) {
|
||||||
var context = dlg,
|
var context = dlg;
|
||||||
btnPlayPause = context.querySelector(".btnPlayPause");
|
var btnPlayPause = context.querySelector(".btnPlayPause");
|
||||||
btnPlayPause.querySelector("i").innerHTML = isPaused ? "play_arrow" : "pause", buttonVisible(btnPlayPause, isActive)
|
btnPlayPause.querySelector("i").innerHTML = isPaused ? "play_arrow" : "pause";
|
||||||
|
buttonVisible(btnPlayPause, isActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTimeDisplay(positionTicks, runtimeTicks) {
|
function updateTimeDisplay(positionTicks, runtimeTicks) {
|
||||||
var context = dlg,
|
var context = dlg;
|
||||||
positionSlider = context.querySelector(".nowPlayingPositionSlider");
|
var positionSlider = context.querySelector(".nowPlayingPositionSlider");
|
||||||
if (positionSlider && !positionSlider.dragging)
|
|
||||||
|
if (positionSlider && !positionSlider.dragging) {
|
||||||
if (runtimeTicks) {
|
if (runtimeTicks) {
|
||||||
var pct = positionTicks / runtimeTicks;
|
var pct = positionTicks / runtimeTicks;
|
||||||
pct *= 100, positionSlider.value = pct
|
pct *= 100;
|
||||||
} else positionSlider.value = 0;
|
positionSlider.value = pct;
|
||||||
context.querySelector(".positionTime").innerHTML = null == positionTicks ? "--:--" : datetime.getDisplayRunningTime(positionTicks), context.querySelector(".runtime").innerHTML = null != runtimeTicks ? datetime.getDisplayRunningTime(runtimeTicks) : "--:--"
|
} else {
|
||||||
|
positionSlider.value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
context.querySelector(".positionTime").innerHTML = null == positionTicks ? "--:--" : datetime.getDisplayRunningTime(positionTicks);
|
||||||
|
context.querySelector(".runtime").innerHTML = null != runtimeTicks ? datetime.getDisplayRunningTime(runtimeTicks) : "--:--";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPlaylistItems(player) {
|
function getPlaylistItems(player) {
|
||||||
return playbackManager.getPlaylist(player)
|
return playbackManager.getPlaylist(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPlaylist(context, player) {
|
function loadPlaylist(context, player) {
|
||||||
getPlaylistItems(player).then(function(items) {
|
getPlaylistItems(player).then(function (items) {
|
||||||
var html = "";
|
var html = "";
|
||||||
html += listView.getListViewHtml({
|
html += listView.getListViewHtml({
|
||||||
items: items,
|
items: items,
|
||||||
smallIcon: !0,
|
smallIcon: true,
|
||||||
action: "setplaylistindex",
|
action: "setplaylistindex",
|
||||||
enableUserDataButtons: !1,
|
enableUserDataButtons: false,
|
||||||
rightButtons: [{
|
rightButtons: [{
|
||||||
icon: "",
|
icon: "",
|
||||||
title: globalize.translate("ButtonRemove"),
|
title: globalize.translate("ButtonRemove"),
|
||||||
id: "remove"
|
id: "remove"
|
||||||
}],
|
}],
|
||||||
dragHandle: !0
|
dragHandle: true
|
||||||
}), items.length ? context.querySelector(".playlistSection").classList.remove("hide") : context.querySelector(".playlistSection").classList.add("hide");
|
});
|
||||||
|
|
||||||
|
if (items.length) {
|
||||||
|
context.querySelector(".playlistSection").classList.remove("hide");
|
||||||
|
} else {
|
||||||
|
context.querySelector(".playlistSection").classList.add("hide");
|
||||||
|
}
|
||||||
|
|
||||||
var itemsContainer = context.querySelector(".playlist");
|
var itemsContainer = context.querySelector(".playlist");
|
||||||
itemsContainer.innerHTML = html;
|
itemsContainer.innerHTML = html;
|
||||||
var playlistItemId = playbackManager.getCurrentPlaylistItemId(player);
|
var playlistItemId = playbackManager.getCurrentPlaylistItemId(player);
|
||||||
|
|
||||||
if (playlistItemId) {
|
if (playlistItemId) {
|
||||||
var img = itemsContainer.querySelector('.listItem[data-playlistItemId="' + playlistItemId + '"] .listItemImage');
|
var img = itemsContainer.querySelector('.listItem[data-playlistItemId="' + playlistItemId + '"] .listItemImage');
|
||||||
img && (img.classList.remove("lazy"), img.classList.add("playlistIndexIndicatorImage"))
|
|
||||||
|
if (img) {
|
||||||
|
img.classList.remove("lazy");
|
||||||
|
img.classList.add("playlistIndexIndicatorImage");
|
||||||
}
|
}
|
||||||
imageLoader.lazyChildren(itemsContainer)
|
}
|
||||||
})
|
|
||||||
|
imageLoader.lazyChildren(itemsContainer);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlaybackStart(e, state) {
|
function onPlaybackStart(e, state) {
|
||||||
console.log("remotecontrol event: " + e.type);
|
console.log("remotecontrol event: " + e.type);
|
||||||
var player = this;
|
var player = this;
|
||||||
onStateChanged.call(player, e, state)
|
onStateChanged.call(player, e, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRepeatModeChange(e) {
|
function onRepeatModeChange(e) {
|
||||||
var player = this;
|
var player = this;
|
||||||
updateRepeatModeDisplay(playbackManager.getRepeatMode(player))
|
updateRepeatModeDisplay(playbackManager.getRepeatMode(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlaylistUpdate(e) {
|
function onPlaylistUpdate(e) {
|
||||||
loadPlaylist(dlg, this)
|
loadPlaylist(dlg, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlaylistItemRemoved(e, info) {
|
function onPlaylistItemRemoved(e, info) {
|
||||||
for (var context = dlg, playlistItemIds = info.playlistItemIds, i = 0, length = playlistItemIds.length; i < length; i++) {
|
var context = dlg;
|
||||||
|
var playlistItemIds = info.playlistItemIds;
|
||||||
|
|
||||||
|
for (var i = 0, length = playlistItemIds.length; i < length; i++) {
|
||||||
var listItem = context.querySelector('.listItem[data-playlistItemId="' + playlistItemIds[i] + '"]');
|
var listItem = context.querySelector('.listItem[data-playlistItemId="' + playlistItemIds[i] + '"]');
|
||||||
listItem && listItem.parentNode.removeChild(listItem)
|
|
||||||
|
if (listItem) {
|
||||||
|
listItem.parentNode.removeChild(listItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlaybackStopped(e, state) {
|
function onPlaybackStopped(e, state) {
|
||||||
console.log("remotecontrol event: " + e.type);
|
console.log("remotecontrol event: " + e.type);
|
||||||
var player = this;
|
var player = this;
|
||||||
state.NextMediaType || (updatePlayerState(player, dlg, {}), loadPlaylist(dlg))
|
|
||||||
|
if (!state.NextMediaType) {
|
||||||
|
updatePlayerState(player, dlg, {});
|
||||||
|
loadPlaylist(dlg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlayPauseStateChanged(e) {
|
function onPlayPauseStateChanged(e) {
|
||||||
updatePlayPauseState(this.paused(), !0)
|
updatePlayPauseState(this.paused(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onStateChanged(event, state) {
|
function onStateChanged(event, state) {
|
||||||
var player = this;
|
var player = this;
|
||||||
updatePlayerState(player, dlg, state), loadPlaylist(dlg, player)
|
updatePlayerState(player, dlg, state);
|
||||||
|
loadPlaylist(dlg, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTimeUpdate(e) {
|
function onTimeUpdate(e) {
|
||||||
var now = (new Date).getTime();
|
var now = new Date().getTime();
|
||||||
|
|
||||||
if (!(now - lastUpdateTime < 700)) {
|
if (!(now - lastUpdateTime < 700)) {
|
||||||
lastUpdateTime = now;
|
lastUpdateTime = now;
|
||||||
var player = this;
|
var player = this;
|
||||||
currentRuntimeTicks = playbackManager.duration(player), updateTimeDisplay(playbackManager.currentTime(player), currentRuntimeTicks)
|
currentRuntimeTicks = playbackManager.duration(player);
|
||||||
|
updateTimeDisplay(playbackManager.currentTime(player), currentRuntimeTicks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onVolumeChanged(e) {
|
function onVolumeChanged(e) {
|
||||||
var player = this;
|
var player = this;
|
||||||
updatePlayerVolumeState(dlg, player.isMuted(), player.getVolume())
|
updatePlayerVolumeState(dlg, player.isMuted(), player.getVolume());
|
||||||
}
|
}
|
||||||
|
|
||||||
function releaseCurrentPlayer() {
|
function releaseCurrentPlayer() {
|
||||||
var player = currentPlayer;
|
var player = currentPlayer;
|
||||||
player && (events.off(player, "playbackstart", onPlaybackStart), events.off(player, "statechange", onStateChanged), events.off(player, "repeatmodechange", onRepeatModeChange), events.off(player, "playlistitemremove", onPlaylistUpdate), events.off(player, "playlistitemmove", onPlaylistUpdate), events.off(player, "playbackstop", onPlaybackStopped), events.off(player, "volumechange", onVolumeChanged), events.off(player, "pause", onPlayPauseStateChanged), events.off(player, "unpause", onPlayPauseStateChanged), events.off(player, "timeupdate", onTimeUpdate), currentPlayer = null)
|
|
||||||
|
if (player) {
|
||||||
|
events.off(player, "playbackstart", onPlaybackStart);
|
||||||
|
events.off(player, "statechange", onStateChanged);
|
||||||
|
events.off(player, "repeatmodechange", onRepeatModeChange);
|
||||||
|
events.off(player, "playlistitemremove", onPlaylistUpdate);
|
||||||
|
events.off(player, "playlistitemmove", onPlaylistUpdate);
|
||||||
|
events.off(player, "playbackstop", onPlaybackStopped);
|
||||||
|
events.off(player, "volumechange", onVolumeChanged);
|
||||||
|
events.off(player, "pause", onPlayPauseStateChanged);
|
||||||
|
events.off(player, "unpause", onPlayPauseStateChanged);
|
||||||
|
events.off(player, "timeupdate", onTimeUpdate);
|
||||||
|
currentPlayer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindToPlayer(context, player) {
|
function bindToPlayer(context, player) {
|
||||||
|
@ -270,141 +481,238 @@ define(["browser", "datetime", "backdrop", "libraryBrowser", "listView", "imageL
|
||||||
var state = playbackManager.getPlayerState(player);
|
var state = playbackManager.getPlayerState(player);
|
||||||
onStateChanged.call(player, {
|
onStateChanged.call(player, {
|
||||||
type: "init"
|
type: "init"
|
||||||
}, state), events.on(player, "playbackstart", onPlaybackStart), events.on(player, "statechange", onStateChanged), events.on(player, "repeatmodechange", onRepeatModeChange), events.on(player, "playlistitemremove", onPlaylistItemRemoved), events.on(player, "playlistitemmove", onPlaylistUpdate), events.on(player, "playbackstop", onPlaybackStopped), events.on(player, "volumechange", onVolumeChanged), events.on(player, "pause", onPlayPauseStateChanged), events.on(player, "unpause", onPlayPauseStateChanged), events.on(player, "timeupdate", onTimeUpdate);
|
}, state);
|
||||||
var playerInfo = playbackManager.getPlayerInfo(),
|
events.on(player, "playbackstart", onPlaybackStart);
|
||||||
supportedCommands = playerInfo.supportedCommands;
|
events.on(player, "statechange", onStateChanged);
|
||||||
currentPlayerSupportedCommands = supportedCommands, updateSupportedCommands(context, supportedCommands)
|
events.on(player, "repeatmodechange", onRepeatModeChange);
|
||||||
|
events.on(player, "playlistitemremove", onPlaylistItemRemoved);
|
||||||
|
events.on(player, "playlistitemmove", onPlaylistUpdate);
|
||||||
|
events.on(player, "playbackstop", onPlaybackStopped);
|
||||||
|
events.on(player, "volumechange", onVolumeChanged);
|
||||||
|
events.on(player, "pause", onPlayPauseStateChanged);
|
||||||
|
events.on(player, "unpause", onPlayPauseStateChanged);
|
||||||
|
events.on(player, "timeupdate", onTimeUpdate);
|
||||||
|
var playerInfo = playbackManager.getPlayerInfo();
|
||||||
|
var supportedCommands = playerInfo.supportedCommands;
|
||||||
|
currentPlayerSupportedCommands = supportedCommands;
|
||||||
|
updateSupportedCommands(context, supportedCommands);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBtnCommandClick() {
|
function onBtnCommandClick() {
|
||||||
currentPlayer && (this.classList.contains("repeatToggleButton") ? toggleRepeat(currentPlayer) : playbackManager.sendCommand({
|
if (currentPlayer) {
|
||||||
|
if (this.classList.contains("repeatToggleButton")) {
|
||||||
|
toggleRepeat(currentPlayer);
|
||||||
|
} else {
|
||||||
|
playbackManager.sendCommand({
|
||||||
Name: this.getAttribute("data-command")
|
Name: this.getAttribute("data-command")
|
||||||
}, currentPlayer))
|
}, currentPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSaveablePlaylistItems() {
|
function getSaveablePlaylistItems() {
|
||||||
return getPlaylistItems(currentPlayer).then(function(items) {
|
return getPlaylistItems(currentPlayer).then(function (items) {
|
||||||
return items.filter(function(i) {
|
|
||||||
return i.Id && i.ServerId
|
return i.Id && i.ServerId
|
||||||
})
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function savePlaylist() {
|
function savePlaylist() {
|
||||||
require(["playlistEditor"], function(playlistEditor) {
|
require(["playlistEditor"], function (playlistEditor) {
|
||||||
getSaveablePlaylistItems().then(function(items) {
|
getSaveablePlaylistItems().then(function (items) {
|
||||||
var serverId = items.length ? items[0].ServerId : ApiClient.serverId();
|
var serverId = items.length ? items[0].ServerId : ApiClient.serverId();
|
||||||
(new playlistEditor).show({
|
new playlistEditor().show({
|
||||||
items: items.map(function(i) {
|
items: items.map(function (i) {
|
||||||
return i.Id
|
return i.Id;
|
||||||
}),
|
}),
|
||||||
serverId: serverId,
|
serverId: serverId,
|
||||||
enableAddToPlayQueue: !1,
|
enableAddToPlayQueue: false,
|
||||||
defaultValue: "new"
|
defaultValue: "new"
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindEvents(context) {
|
function bindEvents(context) {
|
||||||
for (var btnCommand = context.querySelectorAll(".btnCommand"), i = 0, length = btnCommand.length; i < length; i++) btnCommand[i].addEventListener("click", onBtnCommandClick);
|
var btnCommand = context.querySelectorAll(".btnCommand");
|
||||||
context.querySelector(".btnToggleFullscreen").addEventListener("click", function(e) {
|
|
||||||
currentPlayer && playbackManager.sendCommand({
|
for (var i = 0, length = btnCommand.length; i < length; i++) {
|
||||||
|
btnCommand[i].addEventListener("click", onBtnCommandClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
context.querySelector(".btnToggleFullscreen").addEventListener("click", function (e) {
|
||||||
|
if (currentPlayer) {
|
||||||
|
playbackManager.sendCommand({
|
||||||
Name: e.target.getAttribute("data-command")
|
Name: e.target.getAttribute("data-command")
|
||||||
}, currentPlayer)
|
}, currentPlayer);
|
||||||
}), context.querySelector(".btnAudioTracks").addEventListener("click", function(e) {
|
}
|
||||||
currentPlayer && lastPlayerState && lastPlayerState.NowPlayingItem && showAudioMenu(context, currentPlayer, e.target, lastPlayerState.NowPlayingItem)
|
});
|
||||||
}), context.querySelector(".btnSubtitles").addEventListener("click", function(e) {
|
context.querySelector(".btnAudioTracks").addEventListener("click", function (e) {
|
||||||
currentPlayer && lastPlayerState && lastPlayerState.NowPlayingItem && showSubtitleMenu(context, currentPlayer, e.target, lastPlayerState.NowPlayingItem)
|
if (currentPlayer && lastPlayerState && lastPlayerState.NowPlayingItem) {
|
||||||
}), context.querySelector(".btnStop").addEventListener("click", function() {
|
showAudioMenu(context, currentPlayer, e.target, lastPlayerState.NowPlayingItem);
|
||||||
currentPlayer && playbackManager.stop(currentPlayer)
|
}
|
||||||
}), context.querySelector(".btnPlayPause").addEventListener("click", function() {
|
});
|
||||||
currentPlayer && playbackManager.playPause(currentPlayer)
|
context.querySelector(".btnSubtitles").addEventListener("click", function (e) {
|
||||||
}), context.querySelector(".btnNextTrack").addEventListener("click", function() {
|
if (currentPlayer && lastPlayerState && lastPlayerState.NowPlayingItem) {
|
||||||
currentPlayer && playbackManager.nextTrack(currentPlayer)
|
showSubtitleMenu(context, currentPlayer, e.target, lastPlayerState.NowPlayingItem);
|
||||||
}), context.querySelector(".btnRewind").addEventListener("click", function() {
|
}
|
||||||
currentPlayer && playbackManager.rewind(currentPlayer)
|
});
|
||||||
}), context.querySelector(".btnFastForward").addEventListener("click", function() {
|
context.querySelector(".btnStop").addEventListener("click", function () {
|
||||||
currentPlayer && playbackManager.fastForward(currentPlayer)
|
if (currentPlayer) {
|
||||||
}), context.querySelector(".btnPreviousTrack").addEventListener("click", function() {
|
playbackManager.stop(currentPlayer);
|
||||||
currentPlayer && playbackManager.previousTrack(currentPlayer)
|
}
|
||||||
}), context.querySelector(".nowPlayingPositionSlider").addEventListener("change", function() {
|
});
|
||||||
|
context.querySelector(".btnPlayPause").addEventListener("click", function () {
|
||||||
|
if (currentPlayer) {
|
||||||
|
playbackManager.playPause(currentPlayer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
context.querySelector(".btnNextTrack").addEventListener("click", function () {
|
||||||
|
if (currentPlayer) {
|
||||||
|
playbackManager.nextTrack(currentPlayer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
context.querySelector(".btnRewind").addEventListener("click", function () {
|
||||||
|
if (currentPlayer) {
|
||||||
|
playbackManager.rewind(currentPlayer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
context.querySelector(".btnFastForward").addEventListener("click", function () {
|
||||||
|
if (currentPlayer) {
|
||||||
|
playbackManager.fastForward(currentPlayer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
context.querySelector(".btnPreviousTrack").addEventListener("click", function () {
|
||||||
|
if (currentPlayer) {
|
||||||
|
playbackManager.previousTrack(currentPlayer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
context.querySelector(".nowPlayingPositionSlider").addEventListener("change", function () {
|
||||||
var value = this.value;
|
var value = this.value;
|
||||||
|
|
||||||
if (currentPlayer) {
|
if (currentPlayer) {
|
||||||
var newPercent = parseFloat(value);
|
var newPercent = parseFloat(value);
|
||||||
playbackManager.seekPercent(newPercent, currentPlayer)
|
playbackManager.seekPercent(newPercent, currentPlayer);
|
||||||
}
|
}
|
||||||
}), context.querySelector(".nowPlayingPositionSlider").getBubbleText = function(value) {
|
});
|
||||||
|
|
||||||
|
context.querySelector(".nowPlayingPositionSlider").getBubbleText = function (value) {
|
||||||
var state = lastPlayerState;
|
var state = lastPlayerState;
|
||||||
if (!state || !state.NowPlayingItem || !currentRuntimeTicks) return "--:--";
|
|
||||||
|
if (!state || !state.NowPlayingItem || !currentRuntimeTicks) {
|
||||||
|
return "--:--";
|
||||||
|
}
|
||||||
|
|
||||||
var ticks = currentRuntimeTicks;
|
var ticks = currentRuntimeTicks;
|
||||||
return ticks /= 100, ticks *= value, datetime.getDisplayRunningTime(ticks)
|
ticks /= 100;
|
||||||
}, context.querySelector(".nowPlayingVolumeSlider").addEventListener("change", function() {
|
ticks *= value;
|
||||||
playbackManager.setVolume(this.value, currentPlayer)
|
return datetime.getDisplayRunningTime(ticks);
|
||||||
}), context.querySelector(".buttonMute").addEventListener("click", function() {
|
};
|
||||||
playbackManager.toggleMute(currentPlayer)
|
|
||||||
|
context.querySelector(".nowPlayingVolumeSlider").addEventListener("change", function () {
|
||||||
|
playbackManager.setVolume(this.value, currentPlayer);
|
||||||
|
});
|
||||||
|
context.querySelector(".nowPlayingVolumeSlider").addEventListener("mousemove", function () {
|
||||||
|
playbackManager.setVolume(this.value, currentPlayer);
|
||||||
|
});
|
||||||
|
context.querySelector(".nowPlayingVolumeSlider").addEventListener("touchmove", function () {
|
||||||
|
playbackManager.setVolume(this.value, currentPlayer);
|
||||||
|
});
|
||||||
|
context.querySelector(".buttonMute").addEventListener("click", function () {
|
||||||
|
playbackManager.toggleMute(currentPlayer);
|
||||||
});
|
});
|
||||||
var playlistContainer = context.querySelector(".playlist");
|
var playlistContainer = context.querySelector(".playlist");
|
||||||
playlistContainer.addEventListener("action-remove", function(e) {
|
playlistContainer.addEventListener("action-remove", function (e) {
|
||||||
playbackManager.removeFromPlaylist([e.detail.playlistItemId], currentPlayer)
|
playbackManager.removeFromPlaylist([e.detail.playlistItemId], currentPlayer);
|
||||||
}), playlistContainer.addEventListener("itemdrop", function(e) {
|
});
|
||||||
var newIndex = e.detail.newIndex,
|
playlistContainer.addEventListener("itemdrop", function (e) {
|
||||||
playlistItemId = e.detail.playlistItemId;
|
var newIndex = e.detail.newIndex;
|
||||||
playbackManager.movePlaylistItem(playlistItemId, newIndex, currentPlayer)
|
var playlistItemId = e.detail.playlistItemId;
|
||||||
}), context.querySelector(".btnSavePlaylist").addEventListener("click", savePlaylist)
|
playbackManager.movePlaylistItem(playlistItemId, newIndex, currentPlayer);
|
||||||
|
});
|
||||||
|
context.querySelector(".btnSavePlaylist").addEventListener("click", savePlaylist);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlayerChange() {
|
function onPlayerChange() {
|
||||||
bindToPlayer(dlg, playbackManager.getCurrentPlayer())
|
bindToPlayer(dlg, playbackManager.getCurrentPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMessageSubmit(e) {
|
function onMessageSubmit(e) {
|
||||||
var form = e.target;
|
var form = e.target;
|
||||||
return playbackManager.sendCommand({
|
playbackManager.sendCommand({
|
||||||
Name: "DisplayMessage",
|
Name: "DisplayMessage",
|
||||||
Arguments: {
|
Arguments: {
|
||||||
Header: form.querySelector("#txtMessageTitle").value,
|
Header: form.querySelector("#txtMessageTitle").value,
|
||||||
Text: form.querySelector("#txtMessageText", form).value
|
Text: form.querySelector("#txtMessageText", form).value
|
||||||
}
|
}
|
||||||
}, currentPlayer), form.querySelector("input").value = "", require(["toast"], function(toast) {
|
}, currentPlayer);
|
||||||
toast("Message sent.")
|
form.querySelector("input").value = "";
|
||||||
}), e.preventDefault(), e.stopPropagation(), !1
|
|
||||||
|
require(["toast"], function (toast) {
|
||||||
|
toast("Message sent.");
|
||||||
|
});
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSendStringSubmit(e) {
|
function onSendStringSubmit(e) {
|
||||||
var form = e.target;
|
var form = e.target;
|
||||||
return playbackManager.sendCommand({
|
playbackManager.sendCommand({
|
||||||
Name: "SendString",
|
Name: "SendString",
|
||||||
Arguments: {
|
Arguments: {
|
||||||
String: form.querySelector("#txtTypeText", form).value
|
String: form.querySelector("#txtTypeText", form).value
|
||||||
}
|
}
|
||||||
}, currentPlayer), form.querySelector("input").value = "", require(["toast"], function(toast) {
|
}, currentPlayer);
|
||||||
toast("Text sent.")
|
form.querySelector("input").value = "";
|
||||||
}), e.preventDefault(), e.stopPropagation(), !1
|
|
||||||
|
require(["toast"], function (toast) {
|
||||||
|
toast("Text sent.");
|
||||||
|
});
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(ownerView, context) {
|
function init(ownerView, context) {
|
||||||
bindEvents(context), context.querySelector(".sendMessageForm").addEventListener("submit", onMessageSubmit), context.querySelector(".typeTextForm").addEventListener("submit", onSendStringSubmit), events.on(playbackManager, "playerchange", onPlayerChange)
|
bindEvents(context);
|
||||||
|
context.querySelector(".sendMessageForm").addEventListener("submit", onMessageSubmit);
|
||||||
|
context.querySelector(".typeTextForm").addEventListener("submit", onSendStringSubmit);
|
||||||
|
events.on(playbackManager, "playerchange", onPlayerChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed(e) {
|
function onDialogClosed(e) {
|
||||||
releaseCurrentPlayer(), events.off(playbackManager, "playerchange", onPlayerChange), lastPlayerState = null
|
releaseCurrentPlayer();
|
||||||
|
events.off(playbackManager, "playerchange", onPlayerChange);
|
||||||
|
lastPlayerState = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onShow(context, tab) {
|
function onShow(context, tab) {
|
||||||
currentImgUrl = null, bindToPlayer(context, playbackManager.getCurrentPlayer())
|
currentImgUrl = null;
|
||||||
}
|
bindToPlayer(context, playbackManager.getCurrentPlayer());
|
||||||
var dlg, currentPlayer, lastPlayerState, currentPlayerSupportedCommands = [],
|
|
||||||
lastUpdateTime = 0,
|
|
||||||
currentRuntimeTicks = 0,
|
|
||||||
self = this;
|
|
||||||
self.init = function(ownerView, context) {
|
|
||||||
dlg = context, init(ownerView, dlg)
|
|
||||||
}, self.onShow = function() {
|
|
||||||
onShow(dlg, window.location.hash)
|
|
||||||
}, self.destroy = function() {
|
|
||||||
onDialogClosed()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dlg;
|
||||||
|
var currentPlayer;
|
||||||
|
var lastPlayerState;
|
||||||
|
var currentPlayerSupportedCommands = [];
|
||||||
|
var lastUpdateTime = 0;
|
||||||
|
var currentRuntimeTicks = 0;
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
self.init = function (ownerView, context) {
|
||||||
|
dlg = context;
|
||||||
|
init(ownerView, dlg);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.onShow = function () {
|
||||||
|
onShow(dlg, window.location.hash);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.destroy = function () {
|
||||||
|
onDialogClosed();
|
||||||
|
};
|
||||||
|
};
|
||||||
});
|
});
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue