OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 |
| 6 (function () { |
| 7 "use strict"; |
| 8 |
| 9 media.onPlayerOpen(1, 0); |
| 10 media.onPlayerOpen(2, 0); |
| 11 |
| 12 var interval = 1; |
| 13 |
| 14 |
| 15 media.onPlayerProperty(1, new Date().getTime(), 'name', |
| 16 "MMy Named Pllayer 1y Named Player 1"); |
| 17 media.onPlayerProperty(2, new Date().getTime(), 'name', |
| 18 "My Named Player 2"); |
| 19 |
| 20 media.onPlayerProperty(1, new Date().getTime(), 'total_bytes', "1000"); |
| 21 media.onPlayerProperty(2, new Date().getTime(), 'total_bytes', "1000"); |
| 22 |
| 23 var spammer = function (toSpam) { |
| 24 function spamming() { |
| 25 media.onPlayerPropertyNoRecord(1, new Date().getTime(), toSpam, |
| 26 Math.random() * 1000); |
| 27 media.onPlayerPropertyNoRecord(2, new Date().getTime(), toSpam, |
| 28 Math.random() * 1000); |
| 29 } |
| 30 |
| 31 return function () { |
| 32 return setInterval(spamming, interval); |
| 33 }; |
| 34 }; |
| 35 |
| 36 var spamFPS = spammer('fps'); |
| 37 var spamBitrate = spammer('bitrate'); |
| 38 var spamBuffer_start = spammer('buffer_start'); |
| 39 var spamBuffer_current = spammer('buffer_current'); |
| 40 var spamBuffer_end = spammer('buffer_end'); |
| 41 |
| 42 this.fpsTt = spamFPS(); |
| 43 this.bitTt = spamBitrate(); |
| 44 this.spamBuffer_start = spamBuffer_start(); |
| 45 this.spamBuffer_current = spamBuffer_current(); |
| 46 this.spamBuffer_end = spamBuffer_end(); |
| 47 |
| 48 this.stop = function () { |
| 49 clearInterval(this.fpsTt); |
| 50 clearInterval(this.bitTt); |
| 51 clearInterval(this.spamBuffer_start); |
| 52 clearInterval(this.spamBuffer_current); |
| 53 clearInterval(this.spamBuffer_end); |
| 54 }; |
| 55 |
| 56 var first = function () { |
| 57 media.onMediaEvent({ |
| 58 renderer: 5, |
| 59 player: 10, |
| 60 ticksMillis: 0 |
| 61 }); |
| 62 |
| 63 media.addAudioStream({ |
| 64 id: "media1", |
| 65 status: "created", |
| 66 playing: true |
| 67 }); |
| 68 }; |
| 69 var second = function () { |
| 70 media.onMediaEvent({ |
| 71 renderer: 5, |
| 72 player: 10, |
| 73 ticksMillis: 100, |
| 74 params: { |
| 75 test: 5 |
| 76 } |
| 77 }); |
| 78 |
| 79 media.addAudioStream({ |
| 80 id: "media1", |
| 81 status: "created", |
| 82 playing: false |
| 83 }); |
| 84 }; |
| 85 var last = function () { |
| 86 media.onRendererTerminated(5); |
| 87 |
| 88 media.addAudioStream({ |
| 89 id: "media1", |
| 90 status: "closed", |
| 91 playing: true |
| 92 }); |
| 93 }; |
| 94 |
| 95 setTimeout(first, 1000); |
| 96 setTimeout(second, 5000); |
| 97 setTimeout(last, 9000); |
| 98 |
| 99 }.bind(this)()); |
OLD | NEW |