0
Could someone help me? I’m trying to find some way to use Infinite scroll in this code:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "lista.m3u8");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
if (substr($info["http_code"], 0, 2) != 20) {
die("Não possível conectar ao servidor!");
}
preg_match_all('/(tvg-logo="(?<logo>.*?)".+group-title="(?<name>.*?)".+\n(?P<link>http?:\/\/.+))/', $response, $channels, PREG_SET_ORDER);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>nPlay</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://mdbootstrap.com/previews/docs/latest/css/bootstrap.min.css" rel="stylesheet">
<link href="https://mdbootstrap.com/previews/docs/latest/css/mdb.min.css" rel="stylesheet">
<style>
footer{
background-color:#1F2024;
color: #fff;
font-size: 10px;
}
body{
background-color: #171818;
}
.secondbase {
background-color: rgba(255,255,255,.6);
margin-top: -90px;
}
.list-group-item {
border:none;
background-color: #171818;
float: left;
height: 240px;
padding: .5rem .25rem;
width: 150px;
}
.list-group-item img {
border:none;
height: 200px;
width: 140px;
padding: .5rem .25rem;
}
#modal iframe {
border:none;
height: 100%;
width: 100%;
}
.modal-dialog {
width: 100%;
height: 100%;
padding: 0;
}
.modal-content {
background-color: #16171A;
height: 90%;
width: 90%;
border-radius: 0;
}
.modal-body {
height: 84%
}
.navbar {
background-color: #1F2024;
}
img{border-radius: 10px;}
#info_bar{
color: #fff;
font-size: 10px;
text-align: center;
}
</style>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg fixed-top">
<a class="navbar-brand">nPlay</a>
</nav>
</header>
<div class="py-4"></div>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="row">
<ul id="channels-list">
<?php foreach($channels as $channel): ?>
<li class="list-group-item">
<a href="<?php echo $channel["link"] ?>" title="<?php echo $channel["name"] ?>">
<img src="<?php echo $channel["logo"] ?>" class="img-responsive img-circle" />
<div id="info_bar">
<?php echo $channel["name"] ?>
</div>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
</div>
<hr>
<footer class="fixed-bottom">
<div class="text-center "></footer>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://mdbootstrap.com/previews/docs/latest/js/bootstrap.min.js"></script>
<script src="https://mdbootstrap.com/previews/docs/latest/js/mdb.min.js"></script>
<script src="https://mdbootstrap.com/previews/docs/latest/js/jarallax.js"></script>
<script src="https://mdbootstrap.com/previews/docs/latest/js/jarallax-video.js"></script>
<script>
new WOW().init();
$("#channels-list a").click(function(e) {
e.preventDefault();
$("#modal").find(".modal-title").text( $(this).attr("title") );
$("#modal").find(".modal-body")
.empty()
.append( "<iframe allowFullScreen='allowFullScreen' allowscriptaccess='always' src=\""+$(this).attr("href")+"\"></iframe>" ); //Altere essa linha para chamar outro arquivo
$("#modal").modal("show");
});
</script>
<div class="modal fade" tabindex="-1" role="dialog" id="modal" data-backdrop="static">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">%channel_name%</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</body>
</html>
With this code you will not be able to. It is necessary to split the file
lista.m3u8
in several pieces and only then use AJAX to create the infinite scroll effect.– Valdeir Psr
Okay, I’ll try to do it here. Taking advantage that the code is yours... when I close the modal the audio video continues playing, as I could close right?
– Welder Andrade Serute
It is necessary to use the event
$('#myModal').on('hidden.bs.modal')
to destroy the<iframe>
created at the opening.– Valdeir Psr