cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              - /*
-   MIXINS
- */
mixin ngPlayerStream(addClass)
	.row.player(class=addClass)
		.col-xs
			.media
				.media-left.media-middle
					img.enclosure.media-object(ng-src="{{player.trackData.enclosure.url}}" alt='Album jacket')
				.media-body
					.title {{ player.trackData.title | limitTo: 40 }} {{ player.trackData.title.length < 40 ? '' : '...' }}
					.roundLive
					.input-group.controls
						.input-group-btn
							button.animate-color.btn.btn-linkPlayer(type='button' aria-label='{{ player.audio.paused ? "play" : "pause" }}' ng-click="player.audio.paused ? player.playerAction.play() : player.playerAction.pause()")
								i.fa(ng-class="player.audio.paused ? 'fa-play' : 'fa-pause'")
							button.animate-color.btn.btn-linkPlayer(type='button' aria-label='Stop' ng-click="player.playerAction.stop()")
								i.fa.fa-stop
							button.animate-color.btn.btn-linkPlayer(type='button' aria-label='Mute' ng-click='player.audio.muting = !player.audio.muting')
								i.fa(ng-class="player.audio.muting ? 'fa-volume-up' : 'fa-volume-off'")
						input.form-control.volume(type='range' min='0' max='1' step='0.01' ng-model='player.audio.volume' aria-label='Volume')

.container(ng-app="ngPlayerStream" ng-controller="PlayerController as player")
	// Logo : Redek Project
	.row.logo(ng-class="{'animate': playedStream}")
		.col-xs
			a(href="http://www.redekproject.fr/" alt="Logo")
				img.img-fluid(src="http://redekproject.fr/share/Logo.png")
	
	.row
		.col-xs
			h3.titleInfo Player not inverted
	
	// Player not inverted
	+ngPlayerStream("")
	
	.row
		.col-xs
			h3.titleInfo Player inverted
	
	// Player inverted
	+ngPlayerStream("invert")
						
	.row
		.col-xs
			h3.titleInfo Player fullwidth
	
	// Player inverted
	+ngPlayerStream("fullwidth")

            
          
!
            
              /* ====================================== *\
=		STYLE : ngPlayerStream
=		By : RedekProject
=		
=		Class change :
=			.invert : Add this class to ".player" 
=				for invert color
=			.fullwidth : Player at width 100%
\* ====================================== */

/**
*	VARIABLE
**/
	@import url(https://fonts.googleapis.com/css?family=Lato:300,400,700);
	@input-color: #0275d8;
	@input-color-anim: #5bc0de;
	@animate-color: animate-color 1s ease-in-out 3s infinite alternate;

/**
*	BASE AND MODIFICATION
**/
	body {
		background-color: #1E1E20;
		font-family: 'Lato';
	}
	.btn-linkPlayer {
		border-color: transparent;
		background-color: transparent;
		font-weight: 400;
		color: @input-color;
	}
	.btn-linkPlayerDanger {
		border-color: transparent;
		background-color: transparent;
		font-weight: 400;
		color: #C9302C !important;
	}
	input:focus {
		outline: none !important;
	}
	* {
		border-radius: 0px !important;
	}

/**
*	LOGO
**/
.logo {
	&.animate { animation: title-pulse 1s ease-in-out 3s infinite alternate; }
	position: relative;
	left: 50%;
	transform: translateX(-50%);
	width: 25%;
	margin: 20px 0px;
	-webkit-filter: drop-shadow(0px 3px 2px rgba(0,0,0,0.3));
  filter: drop-shadow(0px 3px 2px rgba(0,0,0,0.3));
}

/**
*	INFORMATIONS
**/
	.titleInfo {
		color: white;
		font-weight: bold;
		text-transform: uppercase;
		text-align: center;
		padding: 25px 0px 10px;
		text-shadow: 1px 1px 0 rgba(140,140,140,0.6), -1px -1px 1px rgba(0,0,0,0.67);
	}

/**
*	PLAYER
**/
	.player {
		&.invert {
			background-color: #222B31;
			color: white;
		}
		&.fullwidth { width: 100%; }
		position: relative;
		bottom: 0%;
		left: 50%;
		transform: translateX(-50%);
		width: 50%;
		padding: 5px 5px;
		background-color: #FFF;
		-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.3);
		-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.3);
		box-shadow: 0 1px 2px rgba(0,0,0,0.3);
		color: black;
		.enclosure {
			max-height: 60px;
		}
		.title {
			font-weight: bold;
			padding: 0px 0px 2px;
		}
		.roundLive {
			position: absolute;
			right: 20px;
			top: 8px;
			content: " ";
			width: 10px;
			height: 10px;
			border-radius: 100% !important;
			background-color: red;
			// Animation
				animation: pulse 1s ease-in-out 3s infinite alternate;
				@keyframes pulse {
					0% { box-shadow: 0px 0px 0px 0px red; }
					50% { box-shadow: 0px 0px 5px 0.9px red; }
					100% { box-shadow: 0px 0px 0px 0px red; }
				}
		}
		.controls {
			input.volume[type=range] {
				// Thumb
					&::-webkit-slider-thumb {
						-webkit-appearance: none;
						border: 1px solid grey;
						height: 25px;
						width: 10px;
						margin-top: -10px;
						background: white;
						cursor: pointer;
					}
					&::-moz-range-thumb, &::-ms-thumb {
						border: 1px solid grey;
						height: 25px;
						width: 10px;
						margin-top: -10px;
						background: white;
						cursor: pointer;
				}
				// Slider Track
					&::-webkit-slider-runnable-track {
						width: 100%;
						height: 5px;
						margin-top: 16px;
						cursor: pointer;
						background: @input-color;
						margin-right: 1rem;
					}
					&::-moz-range-track, &::-ms-track, &::-ms-fill-upper {
						width: 100%;
						height: 5px;
						margin-top: 12px;
						cursor: pointer;
						background: @input-color;
						margin-right: 1rem;
					}
					&::-webkit-slider-runnable-track { background: @input-color; }
					&::-ms-fill-lower { background: @input-color; }
					&:focus::-ms-fill-upper { background: @input-color; }
					&:focus::-ms-fill-lower { background: @input-color; }
					&::-ms-track {
						background: transparent;
						border-color: transparent;
						color: transparent;
					}
				margin-left: 1rem;
				-webkit-appearance: none;
				width: 100%;
				background: transparent;
				border: 0px;
				padding: 0px;
			}
	}
}
/**
*	ANIMATION
**/
	// For input
		.animate-color { animation: animate-color 5s linear 1s infinite alternate; }
		@keyframes animate-color {
			0% { color: @input-color; }
			50% { color: @input-color-anim; }
			100% { color: @input-color; }
		}
	// For logo
		@keyframes title-pulse {
			0% {
				-moz-transform: translateX(-50%) scale(1);
				-webkit-transform: translateX(-50%) scale(1);
				-o-transform: translateX(-50%) scale(1);
				-ms-transform: translateX(-50%) scale(1);
				transform: translateX(-50%) scale(1);
			}
			50% {
				-moz-transform: translateX(-50%) scale(1.02);
				-webkit-transform: translateX(-50%) scale(1.02);
				-o-transform: translateX(-50%) scale(1.02);
				-ms-transform: translateX(-50%) scale(1.02);
				transform: translateX(-50%) scale(1.02);
			}
			100% {
				-moz-transform: translateX(-50%) scale(1);
				-webkit-transform: translateX(-50%) scale(1);
				-o-transform: translateX(-50%) scale(1);
				-ms-transform: translateX(-50%) scale(1);
				transform: translateX(-50%) scale(1);
			}
		}
            
          
!
            
              /*******************************************
**	ngPlayerStream - Script for playing
**		a audio stream (Centova Cast, etc...)
**
**	By RedekProject.
**	Version 0.1
********************************************/
(function () {
	angular.module('ngPlayerStream', ['ngAudio'])
		.constant('URI', {
			'CENTOVA_STREAM': 'http://comet.shoutca.st:8975/autodj',
			'CENTOVA_TRACK': 'https://comet.shoutca.st/recentfeed/silenceradio/json/'
		})
		.factory('Data', function($http, $log) {
			var obj = {};
		
			// GET
			obj.get = function(URL, logString) {
				return $http.get(URL)
					.error(function(err) {
						$log.error('[ERROR] > The data recovery functioned it does not reach. Here is the error: "' + err + '" (?)');
					})
			};
		
			return obj;
		})
	
		.controller('PlayerController', function($timeout, $rootScope, $log, ngAudio, Data, URI) {
			var vm = this;
			// Load audio
			var loadAudio = function() {				
				vm.audio = ngAudio.load(URI.CENTOVA_STREAM);
				vm.audio.volume = 0.5;
			}
			loadAudio();
			vm.playerAction = {};
		
			// Get recent track
				var getTrackData = function() {
					Data.get(URI.CENTOVA_TRACK).success(function(data) {
						vm.trackData = data.items[0];
						$timeout(getTrackData, 1000);
					});
				};
				getTrackData();
		
			// Player action
				vm.playerAction.play = function() {
					loadAudio();
					vm.audio.play();
					$rootScope.playedStream = true;
				};
				vm.playerAction.pause = function() {
					vm.audio.pause();
					$rootScope.playedStream = false;
				};		
				vm.playerAction.stop = function() {
					vm.audio.stop();
					$rootScope.playedStream = false;
				}
		});
}).call(this);
            
          
!
999px
Loading ..................

Console