|
11 | 11 |
|
12 | 12 | import org.jsoup.Jsoup; |
13 | 13 | import org.jsoup.nodes.Element; |
14 | | -import org.schabi.newpipe.extractor.MediaFormat; |
15 | 14 | import org.schabi.newpipe.extractor.NewPipe; |
16 | 15 | import org.schabi.newpipe.extractor.StreamingService; |
17 | 16 | import org.schabi.newpipe.extractor.downloader.Downloader; |
|
21 | 20 | import org.schabi.newpipe.extractor.exceptions.ReCaptchaException; |
22 | 21 | import org.schabi.newpipe.extractor.linkhandler.LinkHandler; |
23 | 22 | import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemsCollector; |
24 | | -import org.schabi.newpipe.extractor.stream.AudioStream; |
25 | 23 | import org.schabi.newpipe.extractor.stream.Description; |
26 | 24 | import org.schabi.newpipe.extractor.stream.StreamSegment; |
| 25 | +import org.schabi.newpipe.extractor.streamdata.delivery.simpleimpl.SimpleProgressiveHTTPDeliveryDataImpl; |
| 26 | +import org.schabi.newpipe.extractor.streamdata.format.registry.AudioFormatRegistry; |
| 27 | +import org.schabi.newpipe.extractor.streamdata.stream.AudioStream; |
| 28 | +import org.schabi.newpipe.extractor.streamdata.stream.simpleimpl.SimpleAudioStreamImpl; |
27 | 29 |
|
28 | 30 | import java.io.IOException; |
29 | 31 | import java.util.ArrayList; |
@@ -120,24 +122,23 @@ public long getLength() { |
120 | 122 |
|
121 | 123 | @Override |
122 | 124 | public List<AudioStream> getAudioStreams() { |
123 | | - final List<AudioStream> audioStreams = new ArrayList<>(); |
124 | 125 | final JsonObject streams = showInfo.getObject("audio_stream"); |
125 | 126 |
|
| 127 | + final List<AudioStream> audioStreams = new ArrayList<>(); |
126 | 128 | if (streams.has(MP3_128)) { |
127 | | - audioStreams.add(new AudioStream.Builder() |
128 | | - .setId(MP3_128) |
129 | | - .setContent(streams.getString(MP3_128), true) |
130 | | - .setMediaFormat(MediaFormat.MP3) |
131 | | - .setAverageBitrate(128) |
132 | | - .build()); |
| 129 | + audioStreams.add(new SimpleAudioStreamImpl( |
| 130 | + AudioFormatRegistry.MP3, |
| 131 | + new SimpleProgressiveHTTPDeliveryDataImpl(streams.getString(MP3_128)), |
| 132 | + 128 |
| 133 | + )); |
133 | 134 | } |
134 | 135 |
|
135 | 136 | if (streams.has(OPUS_LO)) { |
136 | | - audioStreams.add(new AudioStream.Builder() |
137 | | - .setId(OPUS_LO) |
138 | | - .setContent(streams.getString(OPUS_LO), true) |
139 | | - .setMediaFormat(MediaFormat.OPUS) |
140 | | - .setAverageBitrate(100).build()); |
| 137 | + audioStreams.add(new SimpleAudioStreamImpl( |
| 138 | + AudioFormatRegistry.OPUS, |
| 139 | + new SimpleProgressiveHTTPDeliveryDataImpl(streams.getString(OPUS_LO)), |
| 140 | + 100 |
| 141 | + )); |
141 | 142 | } |
142 | 143 |
|
143 | 144 | return audioStreams; |
|
0 commit comments