Skip to content

Commit

Permalink
Revert "Fix for Issue #777 and Issue #763"
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Sparacio authored and Dan Sparacio committed Oct 7, 2015
1 parent b2922ce commit 5e1a5cd
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 110 deletions.
2 changes: 1 addition & 1 deletion contrib/akamai/controlbar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

1. **Import CSS and JS**
```
<link rel="stylesheet" href="../../contrib/akamai/controlbar/controlbar.css">
<link rel="stylesheet" href="../../contrib/akamai/controlbar/contolbar.css">
<script src="../../contrib/akamai/controlbar/ControlBar.js"></script>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,14 @@
color: white;
text-shadow: none;
-webkit-font-smoothing: antialiased;

}

.time-display,
.duration-display{
padding:11px;
padding:10px;
color: white;
font-weight: normal;
font-size: .9em;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.time-display{
Expand All @@ -72,15 +70,15 @@

.btn-play-pause{
float: left;
padding:9px 10px;
padding:10px;
cursor: pointer;
}

.btn-caption,
.btn-mute,
.btn-fullscreen {
float: right;
padding:9px 10px;
padding:10px;
cursor: pointer;
}

Expand Down Expand Up @@ -115,7 +113,6 @@
.caption-item-selected{
font-weight: normal;
font-size: .9em;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.caption-item-unselected{
Expand Down
67 changes: 30 additions & 37 deletions samples/captioning/multi-track-captions.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,47 @@
<title>Multiple Language Timed Text Sample</title>
<meta name="description" content="" />

<link rel="stylesheet" href="../../contrib/akamai/controlbar/controlbar.css">
<script src="../../contrib/akamai/controlbar/ControlBar.js"></script>
<script src="../../dist/dash.debug.js"></script>

<script>
var EXTERNAL_CAPTION_URL = "http://dash.edgesuite.net/dash264/TestCases/4b/qualcomm/1/ED_OnDemand_5SecSeg_Subtitles.mpd", // need to manually seek to get stream to start... issue with MPD but only sample with multi adaptations for external sidecar caption text xml
FRAGMENTED_CAPTION_URL = "http://vm2.dashif.org/dash/vod/testpic_2s/multi_subs.mpd",
videoElement,
controlbar,
player;

function startVideo() {
var url = FRAGMENTED_CAPTION_URL,
context;

videoElement = document.querySelector(".videoContainer video");
videoElement = document.querySelector(".dash-video-player video");
context = new Dash.di.DashContext();
player = new MediaPlayer(context);
player.startup();
player.attachView(videoElement);
controlbar = new ControlBar(player); // Checkout ControlBar.js for more info on how to target/add text tracks to UI
controlbar.initialize();
player.setAutoPlay(true);
player.attachSource(url);
player.addEventListener(MediaPlayer.events.TEXT_TRACKS_ADDED, onTracksAdded);
}

function onTracksAdded(e){
var selectMenu = document.getElementById("caption-menu"),
tracks = videoElement.textTracks,
ln = tracks.length;

for(var i=0; i<ln; i++){
var track = tracks[i],
option = document.createElement("option");

option.text = track.language.toUpperCase() + " : " + track.kind;
option.value = i;
selectMenu.add(option);
}
selectMenu.selectedIndex = 1;
selectMenu.addEventListener("change", onCaptionMenuChange);
}

function onCaptionMenuChange(e){
player.setTextTrack(e.currentTarget.selectedIndex - 1);
}

</script>
Expand All @@ -38,40 +55,16 @@
width: 640px;
height: 360px;
}

.videoContainer{
width: 640px;
}
</style>

<body onload="startVideo()">
<div class="videoContainer">
<video preload="auto" autoplay="true" > </video>

<div id="videoController" class="video-controller unselectable">
<div id="playPauseBtn" class="btn-play-pause" title="Play/Pause">
<span id="iconPlayPause" class="icon-play"></span>
</div>
<span id="videoTime" class="time-display">00:00:00</span>

<div id="fullscreenBtn" class="btn-fullscreen" title="Fullscreen">
<span class="icon-fullscreen-enter"></span>
</div>
<input type="range" id="volumebar" class="volumebar" value="1" min="0" max="1" step=".01" />

<div id="muteBtn" class="btn-mute" title="Mute">
<span id="iconMute" class="icon-mute-off"></span>
</div>
<div id="captionBtn" class="btn-caption" title="Closed Caption">
<span class="icon-caption"></span>
</div>

<span id="videoDuration" class="duration-display">00:00:00</span>

<div class="seekContainer">
<input type="range" id="seekbar" value="0" class="seekbar" min="0" step="0.01"/>
</div>
</div>
<div class="dash-video-player">
<video controls="true"></video>
</div>
<div>
<select id="caption-menu">
<option value="-1">Turn Captions OFF</option>
</select>
</div>
</body>
</html>
63 changes: 28 additions & 35 deletions samples/captioning/ttml-ebutt-sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<title>Multiple Language EBU Timed Text Sample</title>
<meta name="description" content="" />

<link rel="stylesheet" href="../../contrib/akamai/controlbar/controlbar.css">
<script src="../../contrib/akamai/controlbar/ControlBar.js"></script>
<script src="../../dist/dash.debug.js"></script>


Expand All @@ -26,20 +24,38 @@
context,
TTMLRenderingDiv;

videoElement = document.querySelector(".videoContainer video");
videoElement = document.querySelector(".dash-video-player video");
TTMLRenderingDiv = document.querySelector("#ttml-rendering-div");
context = new Dash.di.DashContext();
player = new MediaPlayer(context);
player.startup();
player.attachView(videoElement);
player.attachTTMLRenderingDiv(TTMLRenderingDiv);
controlbar = new ControlBar(player); // Checkout ControlBar.js for more info on how to target/add text tracks to UI
controlbar.initialize();
player.setAutoPlay(true);
player.attachSource(url);
player.addEventListener(MediaPlayer.events.TEXT_TRACKS_ADDED, onTracksAdded);
}

function onTracksAdded(e){
var selectMenu = document.getElementById("caption-menu"),
tracks = videoElement.textTracks,
ln = tracks.length;

for(var i=0; i<ln; i++){
var track = tracks[i],
option = document.createElement("option");

option.text = track.language.toUpperCase() + " : " + track.kind;
option.value = i;
selectMenu.add(option);
}
selectMenu.selectedIndex = 1;
selectMenu.addEventListener("change", onCaptionMenuChange);
}

function onCaptionMenuChange(e){
player.setTextTrack(e.currentTarget.selectedIndex - 1);
}

</script>

Expand All @@ -48,40 +64,17 @@
width: 640px;
height: 360px;
}
.videoContainer{
width: 640px;
}
</style>

<body onload="startVideo()">
<div class="videoContainer">
<video preload="auto" autoplay="true" > </video>
<div class="dash-video-player">
<video controls="true"></video>
<div id="ttml-rendering-div"></div>

<div id="videoController" class="video-controller unselectable">
<div id="playPauseBtn" class="btn-play-pause" title="Play/Pause">
<span id="iconPlayPause" class="icon-play"></span>
</div>
<span id="videoTime" class="time-display">00:00:00</span>

<div id="fullscreenBtn" class="btn-fullscreen" title="Fullscreen">
<span class="icon-fullscreen-enter"></span>
</div>
<input type="range" id="volumebar" class="volumebar" value="1" min="0" max="1" step=".01" />

<div id="muteBtn" class="btn-mute" title="Mute">
<span id="iconMute" class="icon-mute-off"></span>
</div>
<div id="captionBtn" class="btn-caption" title="Closed Caption">
<span class="icon-caption"></span>
</div>

<span id="videoDuration" class="duration-display">00:00:00</span>

<div class="seekContainer">
<input type="range" id="seekbar" value="0" class="seekbar" min="0" step="0.01"/>
</div>
</div>
</div>
<div>
<select id="caption-menu">
<option value="-1">Turn Captions OFF</option>
</select>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion samples/dash-if-reference-player/app/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ chart {
.btn-mute,
.btn-fullscreen,
.btn-play-pause{
padding:4px 10px !important;
padding:5px 10px !important;
}

#notes {
Expand Down
2 changes: 1 addition & 1 deletion samples/dash-if-reference-player/eme.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="stylesheet" href="app/lib/bootstrap/css/bootstrap-glyphicons.css">
<link rel="stylesheet" href="app/css/main.css">
<link rel="stylesheet" href="app/css/eme.css">
<link rel="stylesheet" href="../../contrib/akamai/controlbar/controlbar.css">
<link rel="stylesheet" href="../../contrib/akamai/controlbar/contolbar.css">

<!-- http://jquery.com/ -->
<script src="app/lib/jquery/jquery-1.10.2.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion samples/dash-if-reference-player/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="stylesheet" href="app/lib/bootstrap/css/bootstrap-glyphicons.css">
<link rel="stylesheet" href="app/lib/angular.treeview/css/angular.treeview.css">
<link rel="stylesheet" href="app/css/main.css">
<link rel="stylesheet" href="../../contrib/akamai/controlbar/controlbar.css">
<link rel="stylesheet" href="../../contrib/akamai/controlbar/contolbar.css">

<!-- http://jquery.com/ -->
<script src="app/lib/jquery/jquery-1.10.2.min.js"></script>
Expand Down
28 changes: 10 additions & 18 deletions src/streaming/controllers/StreamController.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,42 +417,35 @@
},

onManifestUpdated = function(e) {
var self = this;
if (!e.error) {
//Since streams are not composed yet , need to manually look up useCalculatedLiveEdgeTime to detect if stream
//is SegmentTimeline to avoid using time source
var manifest = e.data.manifest,
streamInfo = self.adapter.getStreamsInfo(manifest)[0],
streamInfo = this.adapter.getStreamsInfo(manifest)[0],
mediaInfo = (
self.adapter.getMediaInfoForType(manifest, streamInfo, "video") ||
self.adapter.getMediaInfoForType(manifest, streamInfo, "audio")
this.adapter.getMediaInfoForType(manifest, streamInfo, "video") ||
this.adapter.getMediaInfoForType(manifest, streamInfo, "audio")
),
adaptation,
useCalculatedLiveEdgeTime;

if (mediaInfo) {
adaptation = self .adapter.getDataForMedia(mediaInfo);
useCalculatedLiveEdgeTime = self.manifestExt.getRepresentationsForAdaptation(manifest, adaptation)[0].useCalculatedLiveEdgeTime;
adaptation = this.adapter.getDataForMedia(mediaInfo);
useCalculatedLiveEdgeTime = this.manifestExt.getRepresentationsForAdaptation(manifest, adaptation)[0].useCalculatedLiveEdgeTime;

if (useCalculatedLiveEdgeTime) {
self .log("SegmentTimeline detected using calculated Live Edge Time");
this.log("SegmentTimeline detected using calculated Live Edge Time");
useManifestDateHeaderTimeSource = false;
}
}

var manifestUTCTimingSources = self.manifestExt.getUTCTimingSources(e.data.manifest),
allUTCTimingSources = (!self.manifestExt.getIsDynamic(manifest) || useCalculatedLiveEdgeTime ) ? manifestUTCTimingSources : manifestUTCTimingSources.concat(UTCTimingSources),
isHTTPS = self.uriQueryFragModel.isManifestHTTPS();
//If https is detected on manifest then lets apply that protocol to timing sources.
allUTCTimingSources.forEach(function(item){
item.value = item.value.replace(isHTTPS ? new RegExp(/^(http:)?\/\//i) : new RegExp(/^(https:)?\/\//i), isHTTPS ? "https://" : "http://");
self.log("Matching timing source protocol to manifest protocol: " , item.value);
});
var manifestUTCTimingSources = this.manifestExt.getUTCTimingSources(e.data.manifest),
allUTCTimingSources = (!this.manifestExt.getIsDynamic(manifest) || useCalculatedLiveEdgeTime ) ? manifestUTCTimingSources : manifestUTCTimingSources.concat(UTCTimingSources);

self .timeSyncController.initialize(allUTCTimingSources, useManifestDateHeaderTimeSource);
this.timeSyncController.initialize(useCalculatedLiveEdgeTime ? manifestUTCTimingSources : allUTCTimingSources, useManifestDateHeaderTimeSource);

} else {
self.reset();
this.reset();
}
};

Expand Down Expand Up @@ -481,7 +474,6 @@
notify: undefined,
subscribe: undefined,
unsubscribe: undefined,
uriQueryFragModel:undefined,

setup: function() {
this[MediaPlayer.dependencies.ManifestUpdater.eventList.ENAME_MANIFEST_UPDATED] = onManifestUpdated;
Expand Down
10 changes: 0 additions & 10 deletions src/streaming/models/URIQueryAndFragmentModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,17 @@ MediaPlayer.models.URIQueryAndFragmentModel = function () {

var URIFragmentDataVO = new MediaPlayer.vo.URIFragmentData(),
URIQueryData = [],
isHTTPS = false,

parseURI = function (uri) {
if (!uri) return null;

var URIFragmentData = [],
testQuery = new RegExp(/[?]/),
testFragment = new RegExp(/[#]/),
testHTTPS = new RegExp(/^(https:)?\/\//i),
isQuery = testQuery.test(uri),
isFragment = testFragment.test(uri),
mappedArr;

isHTTPS = testHTTPS.test(uri);

function reduceArray(previousValue, currentValue, index, array) {
var arr = array[0].split(/[=]/);
array.push({key:arr[0], value:arr[1]});
Expand Down Expand Up @@ -89,19 +85,13 @@ MediaPlayer.models.URIQueryAndFragmentModel = function () {
getURIFragmentData:function(){
return URIFragmentDataVO;
},

getURIQueryData: function(){
return URIQueryData;
},

isManifestHTTPS:function(){
return isHTTPS;
},

reset: function() {
URIFragmentDataVO = new MediaPlayer.vo.URIFragmentData();
URIQueryData = [];
isHTTPS = false;
}
};
};
Expand Down

0 comments on commit 5e1a5cd

Please sign in to comment.