From Event to Action: Accelerate Your Decision Making with Real-Time Automation
IPv4 IPv6 Multi Protocol Media Player
1. IPv4 IPv6 Multi Protocol
Media Player
- APNIC 50 -
Masaaki NABESHIMA
Sep 9, 2020
Copyright (c) kosho.org 1v9-9-2020
2. ◼ Use IPv4 and IPv6
◼ Calculate speeds
◼ Do
• Display speeds
• Choose protocol
Copyright (c) kosho.org 2
IPv4 IPv6 Multi Protocol Media Player
3. ◼ Over 1 / 4 requests are IPv6
• IPv6 Connection rate
• Akamai Report (Dec 2019) *1
• The United States: 45.8%
• Japan: 31.3%
• IIJ Koshien Report (Aug 2019) *2
• Japan : 24%
◼ IPv4 will never disappears
• We will have to keep using both protocols for a long period !
Copyright (c) kosho.org 3
Background: IPv6 is REAL
*1:https://www.akamai.com/us/en/resources/our-thinking/state-of-the-internet-report/state-of-the-internet-ipv6-adoption-visualization.jsp
*2: https://eng-blog.iij.ad.jp/archives/4183
4. ◼ Protocol itself
• Almost the same for performance
◼ Network Implementations are different
• e.g. Base protocols and Aggregation boxes are different
• IPv4: PPPoE
• IPv6: IPoE
• Each aggregation boxes have different capacities
◼ Network Speeds are different
• Many people say IPv6 is faster than IPv4
• IPv4 aggregation boxes are generally full
• IPv6 Aggregation boxes have some margin
Copyright (c) kosho.org 4
Background: IPv4 and IPv6 are different
5. ◼ Recent Media Players
• Players download media chunks by HTTP (HLS, Dash)
• Media chunk: fragments of a movie
• Players reassemble the chunks and generate a full movie
Copyright (c) kosho.org 5
Background: Media Player
Chunk 1 Chunk 2 Chunk 3 Chunk 4 Chunk 5 Chunk 6 Chunk 7 Chunk 8
6. ◼ Basic idea
1, Media Player can use IPv4 and IPv6 in a movie stream
• e.g. one by one
2, Also the Media player can calculate download speeds of each chunks
3, And then, the Media Player can choose the preferable protocol
Copyright (c) kosho.org 6
IPv4 IPv6 Multi Protocol Media Player
IPv6 IPv4 IPv6 IPv4 IPv6 IPv4 IPv6 IPv4
9.1 Mbps 5.4 Mbps 9.8 Mbps 6.4 Mbps 9.9 Mbps 4.8 Mbps 5.8 Mbps 8.7 MbpsDownload Speeds
IPv6 IPv6 IPv6 IPv4 IPv6 IPv6 IPv6 IPv4
Media chunks
7. ◼ Initial Implementation
• My own Player with MSE (Media Source Extensions)
• Many restrictions ( e.g. no trick play, no m3u8, …)
◼ Current Implementation
• Base player: Hls.js (Popular media player for browser)
• https://github.com/video-dev/hls.js/
• Plugin (hls46.js)
• https://github.com/kosho-org/hls-46-plugin/
Copyright (c) kosho.org 7
Implementation
8. ◼ Sample
Copyright (c) kosho.org 8
Plugin Usage <html>
<script src="https://cdn.jsdelivr.net/npm/hls.js@0.14.1"></script>
<video id="video" controls preload="none"></video>
<script src="hls-46.js"></script>
<script src="hls-customload.js"></script>
<script src="cb-2-filesize.js"></script>
<script>
var video = document.getElementById('video');
var videoSrc = 'cb-2.m3u8';
var customLoader = function() {};
customLoader.prototype = new Hls.DefaultConfig.loader();
customLoader.prototype.loadInternal = customLoadInternal;
hls46init(0,"http://ipv4.example.com/","http://ipv6.example.com/",
"https://ipv4.media.example.com/hls/","https://ipv6.media.example.com/hls/");
var hls = new Hls({loader: customLoader});
hls.loadSource(videoSrc);
hls.attachMedia(video);
hls46TextShow();
</script>
</html>
Plug-in Initialization
Subtitle (for speed display)
Initialization
Custom (media) Loader
Initialization
9. ◼ IPv4 IP6 handling
• Need separate URLs
• e.g.
• https://ipv4.example.com/hls/xxx.ts
• https://ipv6.example.com/hls/xxx.ts
• Player determines protocol by (URL) string
◼ Internal Key functions
• urlHandler
• modifies media URLs. It's called by customLoadInternal
• speedHandler
• calculates download speeds. It's called by urlHandler and
ontimeUpdate of html5 video
Copyright (c) kosho.org 9
Current Implementation (hls.js plugin)
10. ◼ Statistics Handling
Copyright (c) kosho.org 10
Current Implementation
Media Server (IPv4)
Media Server (IPv6)
beacon.php (Beacon/POST)
Statistics Server (IPv6)
sid.php (session ID/GET)
uid.php (user ID/GET)
ip.php (IPv6 Address/GET)
Statistic Server (IPv4)
ip.php (IPv4 Address/GET)
11. ◼ Speed Comparison
• IPv4 IPv6 One by one
◼ Protocol Selection
• Initial check mode
• Continuous check mode
Copyright (c) kosho.org 11
Plugin Mode
Use the faster protocolInitial check
Initial check Use both protocols to check speed
16. Copyright (c) kosho.org 16
Stat: Speed Ratio Distribution
Speed Ratio Session # Session %
IPv6 faster (> 4) 41 4.29 %
IPv6 faster (4 ~ 2) 70 7.33 %
IPv6 faster (2 ~ 1.2) 191 20.00 %
Almost same 363 38.01 %
IPv4 faster (2 ~ 1.2) 200 20.94 %
IPv4 faster (4 ~ 2) 58 6.07 %
IPv4 faster (> 4) 32 3.35 %
• IPv6 is not always faster than IPv4
• Reason:
• Old style IPv6 tunneling over IPv4
• Need more study
17. ◼ Most of cases
• We should use IPv6 (Default behavior)
◼ However, some remaining cases we should use IPv4
• This plug-in will work
◼ Note
• Currently, IPv6 users are minor -> IPv6 is faster
• However, the number of IPv6 users increases -> IPv4 can be faster
Copyright (c) kosho.org 17
Summery: IPv4 vs IPv6
18. ◼ New fun way to compare IPv4/IPv6 speeds
• Realtime speed display
• Realistic measurement of streaming video
• Mobile, HD, 4K videos
• Probably work on another player (video.js…)
◼ Work as a player side multi CDN (CDN selection by player,
original goal)
• Without any modification, you can use this plugin as a selector
• CDNs (e.g. Akamai vs Cloudfront)
• Other Protocol (e.g. QUIC vs TCP+HTTP)
Copyright (c) kosho.org 18
Summery: IPv4 IPv6 media player
20. ◼ I need partners
• I would like to realize them with partners
• If you are interested in, please let me know
Copyright (c) kosho.org 20
Future work (collaboration)